This is the mail archive of the gcc-help@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: build error -- can not find operator new


Lin George wrote:

> 1. if the extension name is .cpp (or .cxx), then even if we invoke command gcc, g++ will be used;
> 2. if the extension name is .c and even if we invoke g++, then the code will be compiled as C binary other than C++ binary (and at the same time, C system shared lib will be linked, other than C++ system shared lib).

When you invoke the compiler as gcc, it will treat filenames ending in
.cpp/.cxx/.cc/.C as C++ for the purposes of choosing what language to
interpret the source as, but it will *not* add the necessary runtime
support when linking.  You only get that when you link using g++,
regardless of filenames, since at that point you're dealing with objects
not source files anyway.

Brian


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