Linux compiler

M

Markus L.

Hi, I'm new in C++ and I have a question about compilation on Linux:

In Linux (I use Fedora) there is the GCC. With the gcc-c++ package the
gcc supports C++.

When I want to compile a source file do I have to type
"gcc ./programm.cpp" or
"c++ ./program.cpp" or
"g++ ./program.cpp" ?
 
C

Chris Dams

Dear Markus,

Markus L. said:
When I want to compile a source file do I have to type
"gcc ./programm.cpp" or
"c++ ./program.cpp" or
"g++ ./program.cpp" ?

Why don't you just try it out? g++ is the name that should work and I
would use that one. On my system c++ seems to be a copy of the g++ binary.
gcc does not work because it does not link the c++ standard libarary with
the program. It should be possible to figure out what linker options should
be given to gcc to make this work.

Best wishes,
Chris
 
G

Gianni Mariani

This question is off topic here - you should try the GNU mailing list.
Hi, I'm new in C++ and I have a question about compilation on Linux:

In Linux (I use Fedora) there is the GCC. With the gcc-c++ package the
gcc supports C++.

When I want to compile a source file do I have to type
"gcc ./programm.cpp" or
"c++ ./program.cpp" or
"g++ ./program.cpp" ?


all these commands should work

g++ programm.cpp ### this creates a file named a.out as the exe

g++ -o program programm.cpp

c++ -o program programm.cpp

make program
 
C

Chris Croughton

Hi, I'm new in C++ and I have a question about compilation on Linux:

Linux (and the invocation of any specific compiler) is not on-topic in
c.l.c++.
In Linux (I use Fedora) there is the GCC. With the gcc-c++ package the
gcc supports C++.

It's the gcc package now, which incorporates c++.
When I want to compile a source file do I have to type
"gcc ./programm.cpp" or
"c++ ./program.cpp" or
"g++ ./program.cpp" ?

Yes. However, the first one will probably not link because it will
invoke the linker without the C++ support library. The c++ and g++
invocations are identical (as are cc and gcc).

Chris C
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,200
Messages
2,571,046
Members
47,646
Latest member
xayaci5906

Latest Threads

Top