Intel® oneAPI Threading Building Blocks
Ask questions and share information about adding parallelism to your applications when using this threading library.

Replacing new and delete in MSVC 8.0?

I've follwed the instructions in the O'Reilly TBB book on replacing the standard new and delete with the scalable versions, but I'm running into a multiply defined symbol problem when I hit the linking step:

1>parallelspatialattributes.obj : error LNK2005: "void * __cdecl operator new(unsigned int)" (??2@YAPAXI@Z) already defined in MSVCRTD.lib(MSVCR80D.dll)
1>parallelspatialattributes.obj : error LNK2005: "void __cdecl operator delete(void *)" (??3@YAXPAX@Z) already defined in MSVCRTD.lib(MSVCR80D.dll)

Does anyone know how to tell MSVC not to link in its versions of new and delete?


0 Kudos
1 Reply

I used the example from the book, and tried to reproduce this multiple defined symbols issue in different ways, and didn't succeed. I understand that real projects are much more complicated than the examples, though; so some combination of settings may result in this conflict.

If you could provide the full build log of your application (with all compiler and linker options shown), together with some additional info about what file(s) you put the replacing operators into (parallelspatialattributes.cpp I guess; only into this one?), there might be some ideas arising about what's caused the error.

As far as I remember, /FORCE option passed to the linker should shut it down in cases of multiple and unresolved symbols; but I would count on this as the last resort only.

0 Kudos