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. -- Anton Graham GPG ID: 0x18F78541 <[EMAIL PROTECTED]> You will pay for your sins. If you have already paid, please disregard this message.
pgp3nNcWYZtlX.pgp
Description: PGP signature