Menu

linker errors: LNK2005

2007-03-08
2013-04-22
  • Josh Steiner

    Josh Steiner - 2007-03-08

    Hey, i'm just starting a Visual C++ 2005 project that needs to parse Json data, so jsoncpp seems like a nice library for it.  unfortunately whenever I try to build the simple test project it fails during link like this:

    2>Linking...
    2>msvcprtd.lib(MSVCP80D.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 json_vc71_libmtd.lib(json_reader.obj)
    2>msvcprtd.lib(MSVCP80D.dll) : error LNK2005: "public: __thiscall std::_Container_base::~_Container_base(void)" (??1_Container_base@std@@QAE@XZ) already defined in json_vc71_libmtd.lib(json_reader.obj)
    2>LINK : warning LNK4098: defaultlib 'LIBCMTD' conflicts with use of other libs; use /NODEFAULTLIB:library
    2>C:\Documents and Settings\josh\Desktop\Josh\json_win32test\Debug\json_win32test.exe : fatal error LNK1169: one or more multiply defined symbols found

    I'm sort of at a loss as to how to get it to link, any suggestions?

     
    • Josh Steiner

      Josh Steiner - 2007-03-08

      found it.  How frustrating that was to find, you have to make sure that all the libraries in your solution are set to the same "Runtime Library" option in project properties->c/c++->code generation->runtime library

      in this case, lib_json was set to:

      Multi-threaded Debug (/MTd)

      and the rest of the solution was:

      Multi-threaded Debug DLL (/MDd)

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.