Does g++ really need to compile main, if c++ code is involved?

Tim Prince n8tm@aol.com
Thu Mar 20 12:10:00 GMT 2014


On 3/20/2014 4:27 AM, Eric Wolf wrote:
>
> We have a big bunch of C and C++ code in our product and compile
> main with g++, because I read in
>
> http://www.parashift.com/c++-faq/overview-mixing-langs.html
>
> that this is needed.
>
>
The proper compile mode will be selected regardless of whether you 
invoke gcc, g++, gfortran, ... e.g. according to the file name.  As your 
reference pointed out, that is not true of many other compilers.
The second point in that reference is valid:  g++ includes -lstdc++ 
implicitly, which the other languages do not, so that g++ references can 
be satisfied during linking.

-- 
Tim Prince



More information about the Gcc-help mailing list