1
votes

I have an openCv application that builds and runs fine when using the Mutithreaded Debug Dll option for code generation property. However, I would like to run the application on any computer however, the build fails in Multithreaded Debug mode giving LNK 2005 errors, some examples are

1>msvcprtd.lib(MSVCP100D.dll) : error LNK2005: "public: __thiscall std::_Lockit::~_Lockit(void)" (??1_Lockit@std@@QAE@XZ) already defined in libcpmtd.lib(xlock.obj)

1>msvcprtd.lib(MSVCP100D.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(MSVCP100D.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(MSVCP100D.dll) : error LNK2005: "public: __thiscall std::_Container_base12::~_Container_base12(void)" (??1_Container_base12@std@@QAE@XZ) already defined in opencv2.obj

1>MSVCRTD.lib(MSVCR100D.dll) : error LNK2005: "public: __thiscall std::exception::exception(class std::exception const &)" (??0exception@std@@QAE@ABV01@@Z) already defined in LIBCMTD.lib(stdexcpt.obj)

1>msvcprtd.lib(MSVCP100D.dll) : error LNK2005: "public: void __thiscall std::_Container_base12::_Orphan_all(void)" (?_Orphan_all@_Container_base12@std@@QAEXXZ) already defined in opencv2.obj

1>MSVCRTD.lib(MSVCR100D.dll) : error LNK2005: __invalid_parameter already defined in LIBCMTD.lib(invarg.obj)

1>MSVCRTD.lib(MSVCR100D.dll) : error LNK2005: __CrtDbgReportW already defined in LIBCMTD.lib(dbgrptw.obj)

1>MSVCRTD.lib(MSVCR100D.dll) : error LNK2005: "public: __thiscall std::exception::exception(char const * const &)" (??0exception@std@@QAE@ABQBD@Z) already defined in LIBCMTD.lib(stdexcpt.obj)

1>MSVCRTD.lib(MSVCR100D.dll) : error LNK2005: "public: virtual __thiscall std::exception::~exception(void)" (??1exception@std@@UAE@XZ) already defined in LIBCMTD.lib(stdexcpt.obj)

1>MSVCRTD.lib(MSVCR100D.dll) : error LNK2005: _fclose already defined in LIBCMTD.lib(fclose.obj)

1>MSVCRTD.lib(MSVCR100D.dll) : error LNK2005: _fprintf already defined in LIBCMTD.lib(fprintf.obj)

1>MSVCRTD.lib(MSVCR100D.dll) : error LNK2005: _fopen already defined in LIBCMTD.lib(fopen.obj)

1>MSVCRTD.lib(MSVCR100D.dll) : error LNK2005: _memmove already defined in LIBCMTD.lib(memmove.obj)

1>MSVCRTD.lib(MSVCR100D.dll) : error LNK2005: _free already defined in LIBCMTD.lib(dbgfree.obj)

Any suggestions would be appreciated. I am really stuck here, there is no problem with smaller programs

Thanks

P.S I also use functions from cvBlobslib and code from LIBSVM but it should not be the problem

1

1 Answers

1
votes

If you change to use /MT and /MTd, then all your dependent libraries also need to have been compiled with these settings.

If this is not the case, then these dependencies require linking to the dynamic CRT and your project is trying to link to the static CRT, causing the "already defined" errors you're seeing.