Game Development Community

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

#1
02/20/2002 (11:39 pm)
Thats the problem that doesn't allow the stl to be used....search the forums there is a process you can go through to get it to work I believe.

-Tim aka Spock
#2
02/21/2002 (12:15 am)
Wow, that was a quick reply! Found what you were talking about, thanks!

J