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

Kilian, Jens Jens.KILIAN@advantest.com
Fri Mar 21 21:20:00 GMT 2014


> I tried to find answers to that, by searching this mailing list
> and the internet in general, but didn't find anything. Most
> people don't seem to be aware of that "compile main with c++-compiler"
> rule. If I missed some resource, please excuse.

I remember only one compiler (HP aCC) which requires compiling main()
as C++.  As far as I know GCC never needed this.

Note that you will still need to link using g++, or pass all the
equivalent options to the linker.

Best regards,

	Jens.


More information about the Gcc-help mailing list