Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

STL library conflict

Help
2009-11-27
2013-05-09
  • Hi all,
    I've been attempting to integrate IVT in an OpenSceneGraph application, and i'm getting a lot of linking errors. The problem seems to be related to including STL, and I'm not sure how I can fix it.

    A tiny test program that includes IVT and uses a STL string already generates linking errors such as these:

    msvcprtd.lib(MSVCP90D.dll) : error LNK2005: "public: static unsigned int __cdecl std::char_traits<char>::length(char const *)" (?length@?$char_traits@D@std@@SAIPBD@Z) already defined in ivtd.lib(BitmapCapture.obj)

    I'm using Visual Studio 2008 under Windows. All of the examples compile just fine, but none of those use STL. Any suggestions?

    - Gijsbert dos Santos

     
  • Pedram Azad
    Pedram Azad
    2009-11-29

    Hi Gijsbert,

    this is probably related to the runtime library you are linking against.

    The IVT links per default against Multithreaded (resp. Multithreaded-Debug). If your application links against Multithreaded-DLL (resp. Multithreaded-Debug-DLL) you'll get linker errors. IVT and your application must both link against the same runtime library.

    Open the .sln of your application Visual Studio, then go to the project settings (right click on your project, then go to properties), there open up the branch C/C++ and go to "Code Generation". There you'll find an entry "Runtime Library". Set it to "Multithraded (/MT)" for your release mode and to "Multithreaded-Debug (/MTd)" for your debug mode.

    Please let me know, if that helped.

    Best,
    Pedram

     
  • Hi Pedram,

    Thanks for your help, it now links as it should. I did it the other way around though - compiling all of the IVT libraries in multithreaded dll mode, and now it works fine.

    Regards,
    - Gijsbert