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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 3/20/2014 7:29 AM, Tim Prince wrote:
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.

That's not the point.

I can easily move the main function into a file ending with .c. Linking will still succeed, but I assume, that things will start to go terribly
wrong, when the c++ code throws an exception, which is caught nowhere,
or if one tries to use a global non pod object.

Here I need a catalog of things, I am not allowed to do in the c++ portion of the code, so that nothing goes wrong.

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.

That's useful. So I can use ld to link again, as long as I include -lstdc++ Option. That's all?

Please excuse the missing References header. I subscribed the digest version of the mailing list and my mail programm is defective. I can't
set the References header by hand.

Yours sincerely,

Eric Wolf





[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux