PDA

View Full Version : What is the difference between GCC and G++?



Sunnz
4th March 2005, 02:45 AM
I know this may be a n00blish question but I just can't get my head around it...

I have noticed that some people use GCC and some people use G++ as a C++ compiler, and I tried both of them which both of them are on every Linux machine I used... they seems to be the very same program with same syntax and everything... so I start wonder why there are two compilers that does the extact same thing but only different name!??!?!

So I went to gcc.gnu.org and have a look, and find out that it is a whole free project providing compiler collection, but still, that doesn't answer my initial question, why is that two identical programs with a slightly different name???

Sunnz
4th March 2005, 03:31 AM
Hmm is GCC supposed to be for C only and G++ for C++ only????

.sAm.
4th March 2005, 03:38 AM
Yes, confused me for a while too when I was trying to download the g++ compiler through yum, I found out that g++ comes under gcc-c++ in the list of available packages.

mil10
10th June 2005, 09:37 AM
GCC is a compiler collection. It is mainly used for compilation of C programms. Gcc can be used for other languages also.
G++ is a part of gnu compiler collection(gcc). I mean gcc includes g++ as well. When we use gcc for compilation it uses g++ intern.

Thanks
saby

mil10
10th June 2005, 09:37 AM
Hmm is GCC supposed to be for C only and G++ for C++ only????
GCC is a compiler collection. It is mainly used for compilation of C programms. Gcc can be used for other languages also.
G++ is a part of gnu compiler collection(gcc). I mean gcc includes g++ as well. When we use gcc for compilation it uses g++ intern.

Thanks
saby

tejas
10th June 2005, 10:24 AM
Don't forget gcj

that's java by the way.

However, I'd still use sun's javac

mil10
10th June 2005, 10:38 AM
yes Correct. I mean When we use gcc for C++ compilation it uses g++ intern.

Thanks
Saby

andres9606t
16th June 2005, 01:04 AM
yes Correct. I mean When we use gcc for C++ compilation it uses g++ intern.

Thanks
Saby

That is actually incorrect. g++ is simply a script that passes a certain set of command line arguments to gcc, so g++ uses gcc internally, not the other way around. It used to be an actual bash script in older versions of gcc, now it's a binary executable, but it still does the same thing.

steppewolf
24th June 2005, 10:59 AM
learn a lot

mil10
24th June 2005, 01:05 PM
Yes exactly!..

Thanks
saby

markkuk
24th June 2005, 02:47 PM
The major difference between using "g++" or "gcc" commands with C++ programs is in linking. "g++" will automatically link the code with the C++ runtime library (libstdc++), but you must include it manually if you use "gcc" or "ld".

XPRGMX
4th July 2005, 05:36 PM
gcc is for compiling "c" source code, and g++ is for compiling "c++" source code.