gargob
gargob

Reputation: 21

Compiling using g++, yet still get undefined references to operator new

I'm compiling using g++, yet when it goes to compile the files in the depend file that's in the same directory as the Makefile, I get a

undefined reference to `operator new(unsigned int)'

Thanks.

Edit:

You're right.

How do you use g++ as the linker instead of ld in the context of the Makefile. Been searching but couldn't figure it out.

Upvotes: 2

Views: 1784

Answers (2)

Jan
Jan

Reputation: 1847

This g++ is an embedded compiler (code sourcery for arm). You should tag your question as embedded and/or arm. The compiler wants to tell you that you have to implement _write, _close_r, ... yourself.

Have a look at: http://www.codesourcery.com/sgpp/lite/arm/portal/doc7616/libc.pdf. It describes what the signature is for the functions you need to implement.

Upvotes: 0

Konrad Rudolph
Konrad Rudolph

Reputation: 545923

The tags of your question suggest that you are using ld for linking. Don’t do that; use g++ instead. This will cause the c++stdlib static library to be linked.

Upvotes: 4

Related Questions