Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: [bug] Statically linking to MSVC Libraries causes errors!  (Read 6898 times)

0 Members and 1 Guest are viewing this topic.

MrDoomMaster

  • Newbie
  • *
  • Posts: 26
    • View Profile
[bug] Statically linking to MSVC Libraries causes errors!
« on: February 12, 2008, 05:14:41 pm »
Hi,

In Visual Studio 9, I setup my application to statically link to the MSVC libraries via "Multithreaded Debug" instead of "Multithreaded Debug DLL". When I do so, simply having "sfml-window-s-d.lib" in my additional libraries causes the linker to spit out the following errors (these are only just a few of many):
Code: [Select]
1>msvcprtd.lib(MSVCP90D.dll) : error LNK2005: "void __cdecl std::_Debug_message(wchar_t const *,wchar_t const *,unsigned int)" (?_Debug_message@std@@YAXPB_W0I@Z) already defined in libcpmtd.lib(stdthrow.obj)
1>msvcprtd.lib(MSVCP90D.dll) : error LNK2005: "public: void __thiscall std::_Container_base_secure::_Orphan_all(void)const " (?_Orphan_all@_Container_base_secure@std@@QBEXXZ) already defined in InputRegistry.obj
1>msvcprtd.lib(MSVCP90D.dll) : error LNK2005: "public: __thiscall std::_Container_base_secure::~_Container_base_secure(void)" (??1_Container_base_secure@std@@QAE@XZ) already defined in InputRegistry.obj
1>msvcprtd.lib(MSVCP90D.dll) : error LNK2005: "public: __thiscall std::_Lockit::~_Lockit(void)" (??1_Lockit@std@@QAE@XZ) already defined in libcpmtd.lib(xlock.obj)
1>msvcprtd.lib(MSVCP90D.dll) : error LNK2005: "public: __thiscall std::_Lockit::_Lockit(int)" (??0_Lockit@std@@QAE@H@Z) already defined in libcpmtd.lib(xlock.obj)
1>msvcprtd.lib(MSVCP90D.dll) : error LNK2005: "public: __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::~basic_string<char,struct std::char_traits<char>,class std::allocator<char> >(void)" (??1?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@XZ) already defined in InputRegistry.obj
1>msvcprtd.lib(MSVCP90D.dll) : error LNK2005: "public: __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >(char const *)" (??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@PBD@Z) already defined in InputRegistry.obj

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
[bug] Statically linking to MSVC Libraries causes errors!
« Reply #1 on: February 12, 2008, 05:45:04 pm »
You simply can't link to a different version of the CRT than the libraries you're using.
SFML uses "Multithreaded Debug DLL" in debug mode, so you have to use it as well.
Laurent Gomila - SFML developer

jbadams

  • Newbie
  • *
  • Posts: 12
    • View Profile
[bug] Statically linking to MSVC Libraries causes errors!
« Reply #2 on: February 13, 2008, 11:43:30 am »
Quote from: "Laurent"
You simply can't link to a different version of the CRT than the libraries you're using.
SFML uses "Multithreaded Debug DLL" in debug mode, so you have to use it as well.
Or rebuild a copy of the libraries using the configuration you wish to use.

 

anything