Game Development Community

Link error when adding a header

by Gustavo Boni · in Torque Game Builder · 01/11/2007 (2:37 pm) · 2 replies

Hey guys,

I've just created create a class named "Test" and added to the TGB project on VS2005. It compiled just fine.
Now, i want to make this class scriptable, so i derived it from SimObject. The problem is when i add the headers for the SimObject class

#ifndef _SIMBASE_H_
#include "console/simBase.h"
#endif

I got an error:

1>Test.obj : error LNK2005: "void * __cdecl operator new(unsigned int,void *)" (??2@YAPAXIPAX@Z) already defined in winMemory.obj
1>../../../Games/TGB.exe : fatal error LNK1169: one or more multiply defined symbols found

It only happens when i add any file in the project. If i add something like #include , it compiles fine.

Any idea?

Thanks

#1
01/14/2007 (10:31 pm)
1) you put in your file another declaration of global 'new' function
OR
2) your project file settings(C++ section - VS8) different than setting for other project files
OR
3) you're using - TGB incompatible with STL
OR
4) any more?
First, try to copy exsit object (t2dStaticSprite etc.) with different name.
You will see what is wrong.
#2
01/15/2007 (7:38 am)
Thanks to reply Igor.

I got it working days ago. The problem was the other class that i was including in the header. When i also created this class derived from SimObject i didnt get the error anymore.

Thanks