none
msvcprtd.lib(MSVCP80D.dll) : error LNK2005 RRS feed

  • Question

  • we are currently using static libs and dynamic libs to build a DLL. some of the static libraries use STL. our dynamic DLLs also use STL. the static libraries are 3rd party, so we can't change.
    we are getting the linker errors like

    msvcprtd.lib(MSVCP80D.dll) : error LNK2005: "public: class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > & __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::operator+=(char)" (??Y?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEAAV01@D@Z) already defined in tempPlugIn.lib(tempPlugIn.obj)

    please let us know if there's any solution

    Wednesday, September 16, 2009 2:25 PM

Answers

  • Are you mixing code that's compiled with /MT with code that's compiled with /MD?  Not possible.  Project + Properties, C/C++, Code Generation, Runtime Library.  You will need /MD if your DLL exports any functions that pass STL objects or pointers, knock on the door of the 3rd party vendor to get a /MD static library.  They should always ship both versions.

    Hans Passant.
    • Marked as answer by Wesley Yao Tuesday, September 22, 2009 2:48 AM
    Wednesday, September 16, 2009 7:42 PM
    Moderator

All replies

  • Move the conflicting code into separate DLLs. 

    The following is signature, not part of post
    Please mark the post answered your question as the answer, and mark other helpful posts as helpful.
    Visual C++ MVP
    Wednesday, September 16, 2009 5:22 PM
  • Are you mixing code that's compiled with /MT with code that's compiled with /MD?  Not possible.  Project + Properties, C/C++, Code Generation, Runtime Library.  You will need /MD if your DLL exports any functions that pass STL objects or pointers, knock on the door of the 3rd party vendor to get a /MD static library.  They should always ship both versions.

    Hans Passant.
    • Marked as answer by Wesley Yao Tuesday, September 22, 2009 2:48 AM
    Wednesday, September 16, 2009 7:42 PM
    Moderator