Trying to configure standalone /MT - msvcprt.lib(MSVCP100.dll) : error LNK2005

Hi all,

I’m currently trying to compile a project as a standalone application, and despite reading through numerous threads (both OF and general MSVS) I’m still experiencing issues. The reason I want it to be standalone is because compiling as /MD and including the dll’s doesn’t seem to work consistently (it’s worked on 2 of the 4 machines attempted).

I’d be hugely grateful if anyone could either a) suggest how I could get the /MD to work consistently, or b) suggest where I could be going wrong with the /MT configuration.

So far I’ve tried:

I’m still getting a whole host of LNK2005’ errors, though I have no idea where the duplicate code could be that’s causing these:

  
1>msvcprt.lib(MSVCP100.dll) : error LNK2005: "public: virtual __thiscall std::basic_streambuf<char,struct std::char_traits<char> >::~basic_streambuf<char,struct std::char_traits<char> >(void)" (??1?$basic_streambuf@DU?$char_traits@D@std@@@std@@UAE@XZ) already defined in testApp.obj  
1>msvcprt.lib(MSVCP100.dll) : error LNK2005: "public: int __thiscall std::basic_istream<char,struct std::char_traits<char> >::get(void)" (?get@?$basic_istream@DU?$char_traits@D@std@@@std@@QAEHXZ) already defined in PocoNetmt.lib(HTTPRequest.obj)  
1>msvcprt.lib(MSVCP100.dll) : error LNK2005: "public: class std::basic_ostream<char,struct std::char_traits<char> > & __thiscall std::basic_ostream<char,struct std::char_traits<char> >::put(char)" (?put@?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEAAV12@D@Z) already defined in openframeworksLib.lib(ofShader.obj)  
1>msvcprt.lib(MSVCP100.dll) : error LNK2005: "public: virtual __thiscall std::basic_ios<char,struct std::char_traits<char> >::~basic_ios<char,struct std::char_traits<char> >(void)" (??1?$basic_ios@DU?$char_traits@D@std@@@std@@UAE@XZ) already defined in testApp.obj  
1>msvcprt.lib(MSVCP100.dll) : error LNK2005: "protected: __thiscall std::basic_ios<char,struct std::char_traits<char> >::basic_ios<char,struct std::char_traits<char> >(void)" (??0?$basic_ios@DU?$char_traits@D@std@@@std@@IAE@XZ) already defined in testApp.obj  
1>msvcprt.lib(MSVCP100.dll) : error LNK2005: "public: __thiscall std::basic_istream<char,struct std::char_traits<char> >::basic_istream<char,struct std::char_traits<char> >(class std::basic_streambuf<char,struct std::char_traits<char> > *,bool)" (??0?$basic_istream@DU?$char_traits@D@std@@@std@@QAE@PAV?$basic_streambuf@DU?$char_traits@D@std@@@1@_N@Z) already defined in openframeworksLib.lib(ofFileUtils.obj)  
1>msvcprt.lib(MSVCP100.dll) : error LNK2005: "public: virtual __thiscall std::basic_istream<char,struct std::char_traits<char> >::~basic_istream<char,struct std::char_traits<char> >(void)" (??1?$basic_istream@DU?$char_traits@D@std@@@std@@UAE@XZ) already defined in openframeworksLib.lib(ofFileUtils.obj)  
1>msvcprt.lib(MSVCP100.dll) : error LNK2005: "public: __thiscall std::basic_ostream<char,struct std::char_traits<char> >::basic_ostream<char,struct std::char_traits<char> >(class std::basic_streambuf<char,struct std::char_traits<char> > *,bool)" (??0?$basic_ostream@DU?$char_traits@D@std@@@std@@QAE@PAV?$basic_streambuf@DU?$char_traits@D@std@@@1@_N@Z) already defined in testApp.obj  
1>msvcprt.lib(MSVCP100.dll) : error LNK2005: "public: virtual __thiscall std::basic_ostream<char,struct std::char_traits<char> >::~basic_ostream<char,struct std::char_traits<char> >(void)" (??1?$basic_ostream@DU?$char_traits@D@std@@@std@@UAE@XZ) already defined in testApp.obj  
1>msvcprt.lib(MSVCP100.dll) : error LNK2005: "protected: void __thiscall std::basic_streambuf<char,struct std::char_traits<char> >::setp(char *,char *)" (?setp@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IAEXPAD0@Z) already defined in testApp.obj  
1>msvcprt.lib(MSVCP100.dll) : error LNK2005: "protected: void __thiscall std::basic_streambuf<char,struct std::char_traits<char> >::setg(char *,char *,char *)" (?setg@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IAEXPAD00@Z) already defined in testApp.obj  
1>msvcprt.lib(MSVCP100.dll) : error LNK2005: "protected: __thiscall std::basic_streambuf<char,struct std::char_traits<char> >::basic_streambuf<char,struct std::char_traits<char> >(void)" (??0?$basic_streambuf@DU?$char_traits@D@std@@@std@@IAE@XZ) already defined in testApp.obj  
1>msvcprt.lib(MSVCP100.dll) : error LNK2005: "void __cdecl std::_Xlength_error(char const *)" (?_Xlength_error@std@@YAXPBD@Z) already defined in libcpmt.lib(xthrow.obj)  
1>msvcprt.lib(MSVCP100.dll) : error LNK2005: "void __cdecl std::_Xout_of_range(char const *)" (?_Xout_of_range@std@@YAXPBD@Z) already defined in libcpmt.lib(xthrow.obj)  
1>msvcprt.lib(MSVCP100.dll) : error LNK2005: "public: __thiscall std::ios_base::operator void *(void)const " (??Bios_base@std@@QBEPAXXZ) already defined in openframeworksLib.lib(ofFileUtils.obj)  
1>msvcprt.lib(MSVCP100.dll) : error LNK2005: "public: class std::basic_ostream<char,struct std::char_traits<char> > & __thiscall std::basic_ostream<char,struct std::char_traits<char> >::write(char const *,__int64)" (?write@?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEAAV12@PBD_J@Z) already defined in openframeworksLib.lib(ofFileUtils.obj)  
1>msvcprt.lib(MSVCP100.dll) : error LNK2005: "public: __int64 __thiscall std::basic_istream<char,struct std::char_traits<char> >::gcount(void)const " (?gcount@?$basic_istream@DU?$char_traits@D@std@@@std@@QBE_JXZ) already defined in openframeworksLib.lib(ofFileUtils.obj)  
1>msvcprt.lib(MSVCP100.dll) : error LNK2005: "public: class std::basic_istream<char,struct std::char_traits<char> > & __thiscall std::basic_istream<char,struct std::char_traits<char> >::read(char *,__int64)" (?read@?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV12@PAD_J@Z) already defined in openframeworksLib.lib(ofFileUtils.obj)  
1>msvcprt.lib(MSVCP100.dll) : error LNK2005: "public: void __thiscall std::_Container_base0::_Orphan_all(void)" (?_Orphan_all@_Container_base0@std@@QAEXXZ) already defined in main.obj  
  

Any help would be hugely appreciated! :slight_smile:

Cheers,
Matt

Hi Matt,

Those errors explain there is a conflict with default library.
Try this:
[list]

  • Open the project’s Property Pages dialog box.

  • Click the Linker folder.

  • Click the Input property page.

  • Add msvcprt in the list of the libraries we want to ignore, in the Ignore Specific Library property.

[/list]

Thanks for the quick reply! This seemed to fix the immediate problem, though it left me with a couple of missing link errors.

In the meantime I’ve managed to have a bit more luck moving everything over to Code Blocks and compiling with GCC - this has at least allowed me to get it working on a few more machines (albeit with the dll’s), but this will have to suffice for now. I imagine I’ll pick up the search for a standalone solution once this project’s done.