Torque and #include question
by Jared Hoberock · in Torque Game Engine · 02/20/2002 (11:21 pm) · 2 replies
While trying to integrate Torque with a set of entirely unrelated classes (which #include and other STL templates), I've encountered a strange error. Depending on where I #include I get either a linker or compiler error.
Here's the compilation error:
c:\torque\engine\platformwin32\winmemory.cc(44) : error C2084: function 'void *__cdecl operator new(unsigned int,void *)' already has a body
Here's the linker error:
winMemory.obj : error LNK2005: "void * __cdecl operator new(unsigned int,void *)" (??2@YAPAXIPAX@Z) already defined in terraformer.obj
Within the include file \microsoft visual studio\vc98\include\new, operator new() is defined as such:
inline void *__cdecl operator new(size_t, void *_P)
{return (_P); }
Which is identical to that function defined in \platform32\winmemory.cc around line 39
My solution was to simply comment out the function defined in \platform32\winmemory.cc. This allows #include to work and the project builds successfully.
Still, I'm wondering if there's a safer way to fix this error. Any ideas?
Thanks,
J
Here's the compilation error:
c:\torque\engine\platformwin32\winmemory.cc(44) : error C2084: function 'void *__cdecl operator new(unsigned int,void *)' already has a body
Here's the linker error:
winMemory.obj : error LNK2005: "void * __cdecl operator new(unsigned int,void *)" (??2@YAPAXIPAX@Z) already defined in terraformer.obj
Within the include file \microsoft visual studio\vc98\include\new, operator new() is defined as such:
inline void *__cdecl operator new(size_t, void *_P)
{return (_P); }
Which is identical to that function defined in \platform32\winmemory.cc around line 39
My solution was to simply comment out the function defined in \platform32\winmemory.cc. This allows #include
Still, I'm wondering if there's a safer way to fix this error. Any ideas?
Thanks,
J
About the author
Associate Tim Newell
Max Gaming Technologies
-Tim aka Spock