This is the mail archive of the
mailing list for the GCC project.
Re: build error -- can not find operator new
- From: Brian Dessent <brian at dessent dot net>
- To: Lin George <george4academic at yahoo dot com>
- Cc: skaller <skaller at users dot sourceforge dot net>, gcc-help at gcc dot gnu dot org
- Date: Mon, 05 Nov 2007 04:16:25 -0800
- Subject: Re: build error -- can not find operator new
- References: <email@example.com>
- Reply-to: gcc-help at gcc dot gnu dot org
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.