This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: build error -- can not find operator new
- From: Lin George <george4academic at yahoo dot com>
- To: brian at dessent dot net
- Cc: skaller <skaller at users dot sourceforge dot net>, gcc-help at gcc dot gnu dot org
- Date: Mon, 5 Nov 2007 04:29:25 -0800 (PST)
- Subject: Re: build error -- can not find operator new
Thanks for your description Brian, yes, I agree that it should be during link time when the runtime shared lib (with libc or libc++) is considered to choose.
regards,
George
----- Original Message ----
From: Brian Dessent <brian@dessent.net>
To: Lin George <george4academic@yahoo.com>
Cc: skaller <skaller@users.sourceforge.net>; gcc-help@gcc.gnu.org
Sent: Monday, November 5, 2007 8:16:25 PM
Subject: 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
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com