LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Closed Thread
  Search this Thread
Old 04-18-2005, 06:22 PM   #1
divorce3
Member
 
Registered: Apr 2004
Posts: 33

Rep: Reputation: 15
C++


I'm trying to compile and run C++ in Fedora Core3 with no success.
C no problem but they are hiding the C++ compiler somewhere.
Does anyone know the command.

Thanks
 
Old 04-18-2005, 06:28 PM   #2
Mega Man X
LQ Guru
 
Registered: Apr 2003
Location: ~
Distribution: Ubuntu, FreeBSD, Solaris, DSL
Posts: 5,339

Rep: Reputation: 65
Please, post your code and commands you are trying to compile and, of course, the errors messages you are getting.
 
Old 04-18-2005, 06:50 PM   #3
divorce3
Member
 
Registered: Apr 2004
Posts: 33

Original Poster
Rep: Reputation: 15
Megaman X

My code is fine. Why would you want error messages.
All I want is the command as in C to compile:gcc -o hello hello.c
to run: ./hello
 
Old 04-18-2005, 07:21 PM   #4
Mega Man X
LQ Guru
 
Registered: Apr 2003
Location: ~
Distribution: Ubuntu, FreeBSD, Solaris, DSL
Posts: 5,339

Rep: Reputation: 65
Quote:
Originally posted by divorce3
Megaman X

My code is fine. Why would you want error messages.
All I want is the command as in C to compile:gcc -o hello hello.c
to run: ./hello
Because if I don't know what you are typing to compile, I don't know why it's not working. If you get a "commando not found", then most likely you have gcc but not g++ installed. The command should be:

g++ -o hello hello.cpp

That could be different in FC. Redhat tends to like custom names, paths and kernel

It's always important to give as much detail as possible... regardless the problem and always give the error messages... that's how we start to debug something

Last edited by Mega Man X; 04-18-2005 at 07:25 PM.
 
Old 04-18-2005, 08:19 PM   #5
divorce3
Member
 
Registered: Apr 2004
Posts: 33

Original Poster
Rep: Reputation: 15
Megaman X

That command works perfectly well with Red Hat 7 which I have
been using. Apparently g++ is in there somewhere but it has to
be accessed through gcc according to the Man page but I can't
work it out.
 
Old 04-18-2005, 08:28 PM   #6
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
Tried a
locate g++ | grep bin
yet?

Or, since it's Redhat,
rpm -ql `rpm -qa` | grep g++



Cheers,
Tink
 
Old 04-18-2005, 09:26 PM   #7
Mega Man X
LQ Guru
 
Registered: Apr 2003
Location: ~
Distribution: Ubuntu, FreeBSD, Solaris, DSL
Posts: 5,339

Rep: Reputation: 65
I went to Fedora's homepage and found that the package name for g++ is called "gcc-c++-4.0.0-0.42.i386.rpm"

I would try "gcc-c++ -o hello hello.cpp" as a blind shot. And man, I loved Redhat 7.x series. 7.3 is absolutely my favorite. Things got pretty rough after that though... starting with custom kernel and drop of mp3/media support :\
 
Old 04-18-2005, 09:51 PM   #8
trickykid
LQ Guru
 
Registered: Jan 2001
Posts: 24,149

Rep: Reputation: 269Reputation: 269Reputation: 269
You can't compile in Fedora Core cause they don't install it by default, unless you specified it during a custom install. Install the appropiate packages and you'll have your C compiler.
 
Old 04-19-2005, 12:27 AM   #9
reddazz
LQ Guru
 
Registered: Nov 2003
Location: N. E. England
Distribution: Fedora, CentOS, Debian
Posts: 16,298

Rep: Reputation: 77
If you install gcc-c++ using yum or apt, then your problems should be solved. To compile a program, you still have to run the command as "g++".
 
Old 04-19-2005, 11:25 AM   #10
divorce3
Member
 
Registered: Apr 2004
Posts: 33

Original Poster
Rep: Reputation: 15
locate g++ | grep bin
It is in /usr/bin but I still don't Know the command to compile.
 
Old 04-19-2005, 12:44 PM   #11
Komakino
Senior Member
 
Registered: Feb 2004
Location: Somerset, England
Distribution: Slackware 10.2, Slackware 10.0, Ubuntu 9.10
Posts: 1,938

Rep: Reputation: 55
Quote:
Originally posted by divorce3
locate g++ | grep bin
It is in /usr/bin but I still don't Know the command to compile.
The command to compile is:
g++ file.cc -o file

Which will compile file.cc into the binary "file".

g++ is a kind of wrapper to gcc (which is what you read in the man page and why you see it as being called through gcc) but you still call it as g++.
 
Old 04-19-2005, 11:02 PM   #12
divorce3
Member
 
Registered: Apr 2004
Posts: 33

Original Poster
Rep: Reputation: 15
Komakino

I tried that, nothing!
 
Old 04-19-2005, 11:32 PM   #13
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
Absolutely nothing, not even a shell error message?

C'mon mate, be more specific, provide us with info :}


Cheers,
Tink
 
Old 04-20-2005, 12:22 AM   #14
divorce3
Member
 
Registered: Apr 2004
Posts: 33

Original Poster
Rep: Reputation: 15
tink

g++ file.cc -o file produced a million lines similar to this:

/usr/lib/gcc/i386-redhat-linux/3.4.2./../../../../include/c++/3.4.2/i386-redhat-linux/bita/codecvt-specializations.h:269:error-inbytes'was
not declared in this scope
 
Old 04-20-2005, 12:30 AM   #15
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
In other words the source is flawed, or some includes
are missing/messed up ... g++ *IS* working, just doesn't
give you what you expect.


Cheers,
Tink

Last edited by Tinkster; 04-20-2005 at 12:31 AM.
 
  


Closed Thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 04:20 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration