Game Development Community

Problems Linking external libraries into TGE

by Jared Stallings · in Technical Issues · 05/17/2006 (10:07 am) · 3 replies

I am attempting to create a situational awareness visualization tool using the torque game engine. This visualization tool needs to receive data from an external source for positions of objects in the playing field. My first thought to do this, was to link in my Message-Oriented-Middleware code directly into the game engine, and have a connection created within the game server application, and have it receive and act on the messages directly.

The first question here, is would it be better to create a gateway application that listens to this external MOM for data, and opens up a torque connection with the game server (meaning I'd have to figure out how to send data using torque formats and protocols)?

If it isn't, then I'm having a problem linking. When I include the header files from the MOM client API in with torque, it compiles fine, but I was getting a link error. I fiddled with it for quite some time, and found that the problem came with the MOM header files #including . So, I remove all those header files, and basically all i have is a new class in the game section of the code, and the .cc file has this in it

#include
using namespace std;
#include "platform/platform.h"

When I link, I get the following errors:

RadiumConnection.obj : error LNK2005: "void * __cdecl operator new(unsigned int,void *)" (??2@YAPAXIPAX@Z) already defined in winMemory.obj

and

../example/torqueDemo_DEBUG.exe : fatal error LNK1169: one or more multiply defined symbols found

I assume this is because torque itself defines 'new', which is also done in some STL class. Is there any way to get around this? or is it basically a no-no to link in external libraries that use STL functionality?

Any comments/help/suggestions would be appreciated.

About the author

Recent Threads


#1
05/17/2006 (11:27 am)
With my code I just did this and it worked.

#ifndef TORQUE_PLUGIN_ATL
//--------------------------------------
void* FN_CDECL operator new(dsize_t, void* ptr)
{
return (ptr);
}
#endif // TORQUE_PLUGIN_ATL

It may or may not work for you :)
#2
05/17/2006 (12:05 pm)
This doesn't seem to be working. However, I'm assuming that what you did was go into the winMemory.cc file and basically just put your #ifndef around the existing function there. Then you put TORQUE_PLUGIN_ATL in your preprocessor Definintions?

Are these assumptions correct, or did you do this some other way?
#3
05/17/2006 (12:20 pm)
Yeah. I'm working on an ATL plugin of torque and just use those ifdefs to modify the code where I need to without changing a lot.