GCC vs G++

David Daney ddaney@avtrex.com
Wed Jun 13 03:37:00 GMT 2007


NightStrike wrote:
> On 11 Jun 2007 10:08:11 -0700, Ian Lance Taylor <iant@google.com> wrote:
>> <Dhiraj.Nilange@iflexsolutions.com> writes:
>>
>> > I am using Linux. I am not still sure about the difference between g++
>> > and gcc. Is g++ just a wrapper for gcc? I am not sure which one I 
>> should
>> > use
>> > for compiling my C++ codes?
>>
>> g++ is very similar to gcc.  The main difference is that g++ assumes
>> that it is compiling C++ (gcc will compile C++ for files ending in
>> ".cc", ".C", etc.), and g++ always links against the standard C++
>> library.
>>
>> When compiling C++ you should use g++ in all normal cases.
>
> So the way I read this is that I *could* use gcc for compiling .cpp
> files that use c++ libraries, correct?
Yes.
> It never seems to work, even
> for a simple "Hello, world."
It works for me everyday, but I know all the special things I have to do 
on the platform I am using.

The reason to use g++ is that it works with no special non-portable magic.

David Daney



More information about the Gcc-help mailing list