Brock Greman - 2008-06-03

I have been attempting to integrate TinyXML into a project I am working on, which is based on the OGRE graphics engine.

My solution setup is to have the project for the Ogre app, and a separate project compiling TinyXML to a static lib.  The first problem was that I had to change the runtime target of the TinyXML project to a multi-threaded DLL to match the setup OGRE uses.

That fixed the vast majority of my initial linker errors.  However, I still have some remaining.  In one of the .cpp files (utilities.cpp) in the OGRE application project, I have #included tinyxml.h

The following codes results in a linker error, only if the TIXML_USE_STL macro is defined:

---------------CODE--------------

bool UtilFuncClass::loadShipFromTinyXml(std::string fileName, SHIP::ShipBase *theShip)
{
    TiXmlDocument theDocument(fileName.c_str());
    theDocument.LoadFile();
    return true;
}

---------------------------------

The error produced is:

---------------CODE--------------

utilities.obj : error LNK2001: unresolved external symbol "private: static struct TiXmlString::Rep TiXmlString::nullrep_" (?nullrep_@TiXmlString@@0URep@1@A)
bin\Debug\Starships.exe : fatal error LNK1120: 1 unresolved externals

---------------------------------

If I remove the TIXML_USE_STL define, everything compiles just fine.  However, I'd much prefer to be able to use STL to simplify string-casting between TinyXML and the OGRE objects I'm reading/writing.

Any tips would be appreciated, thanks.