This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: I need help with compiling/linking c++ programs under gcc 3.0.4[UW/EEResearch Computing #51]


Diego Novillo wrote:
> On Thu, 07 Mar 2002, Jeff Silverman wrote:
> 
> 
>>This worked!!!!
>>
>>I don't understand why.  I was under the impression that the gcc would
>>handle either C++ or C code?  Obviously, I'm wrong.  But I don't get it.
>>
> 
> Yes and no.  To give you a rough idea, both gcc and g++ share a
> common back end (the code generator and optimizer), but they
> differ in how they parse your program (the front end) and the
> runtime glue that needs to be linked to generate the final
> executable.

Er - I.think the question was referring to 'gcc' command, not
GCC, the Gnu Compiler Collection.

And yes, the gcc command can compile both C and C++ code.
However, you were *linking* a program, which includes linking
it with appropriate run-time libraries.  The 'g++' command
automatically add the needed C++ run-time libraries for C++
*and* C, but the 'gcc' commands only add teh libraries for C.

Perhaps one way we'll make 'gcc' smart enough to link with
needed libraries, but not yet.
-- 
	--Per Bothner
per@bothner.com   http://www.bothner.com/per/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]