Thursday, July 13, 2006

void * __cdecl operator new(unsigned int) error during linking

Recently while trying to create a DLL in managed C++, i came across an error about : error "void * __cdecl >operator new(unsigned int)" (??2@YAPAXI@Z) being undefined!

This occured when I tried to create a dynamic unmanaged array in a managed class.

That is : within a gc class, I could not do the following int __nogc* buffer = new __nogc[100];

but in a non-gc class I could do it!

After much searching I found the resolution to be this:

Add msvcrt.lib to the input section of the linker property pages of your project settings. Thats all!

1 comment:

Remember, if you want me to respond to your comment, then you need to use a Google/OpenID account to leave the comment.