Re: build error -- can not find operator new

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

 



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@xxxxxxxxxxx>
To: Lin George <george4academic@xxxxxxxxx>
Cc: skaller <skaller@xxxxxxxxxxxxxxxxxxxxx>; gcc-help@xxxxxxxxxxx
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 

[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