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

Re: woody and gcc 3.0 unresolved symbol "new" with c++ program



Thanks to you all that helped out.  Both solutions below work.

Anton Graham wrote:
Submitted 07-Feb-02 by hanasaki:

I am getting the following errors when gcc links the program I am compiling. What libs do I need to make the linker happy?

errors:
/tmp/ccgPzIMj.o: In function `main':
/tmp/ccgPzIMj.o(.text+0xf): undefined reference to `operator new(unsigned)'
/tmp/ccgPzIMj.o(.text+0x3a): undefined reference to `operator delete(void*)'

<snip>

Two solutions, the first being simpler: use g++ in place of gcc, or add
-lstdc++ to the command line.  gcc doesn't automatically determine file
type based on extension, although one could trivially write a wrapper
script to do so.  As a result, when the C compiler processes a C++
source file, it doesn't know to link in the C++ library.




--
hanasaki@hanaden.com
	Spam : def: It's not kosher.



Reply to: