build error -- can not find operator new
Brian Dessent
brian@dessent.net
Mon Nov 5 12:16:00 GMT 2007
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
More information about the Gcc-help
mailing list