1

我有一个 openCv 应用程序,当使用多线程调试 Dll 选项进行代码生成属性时,它可以正常构建和运行。但是,我想在任何计算机上运行该应用程序,但是在多线程调试模式下构建失败,给出 LNK 2005 错误,一些示例是

1>msvcprtd.lib(MSVCP100D.dll) : 错误 LNK2005: "public: __thiscall std::_Lockit::~_Lockit(void)" (??1_Lockit@std@@QAE@XZ) 已经在 libcpmtd.lib(xlock) 中定义.obj)

1>msvcprtd.lib(MSVCP100D.dll) : 错误 LNK2005: "public: __thiscall std::_Lockit::_Lockit(int)" (??0_Lockit@std@@QAE@H@Z) 已经在 libcpmtd.lib( xlock.obj)

1>msvcprtd.lib(MSVCP100D.dll) : 错误 LNK2005: "void __cdecl std::_Debug_message(wchar_t const *,wchar_t const *,unsigned int)" (?_Debug_message@std@@YAXPB_W0I@Z) 已在 libcpmtd 中定义。库(stdthrow.obj)

1>msvcprtd.lib(MSVCP100D.dll) : 错误 LNK2005: "public: __thiscall std::_Container_base12::~_Container_base12(void)" (??1_Container_base12@std@@QAE@XZ) 已在 opencv2.obj 中定义

1>MSVCRTD.lib(MSVCR100D.dll) : 错误 LNK2005: "public: __thiscall std::exception::exception(class std::exception const &)" (??0exception@std@@QAE@ABV01@@Z)已在 LIBCMTD.lib(stdexcpt.obj) 中定义

1>msvcprtd.lib(MSVCP100D.dll) : 错误 LNK2005: "public: void __thiscall std::_Container_base12::_Orphan_all(void)" (?_Orphan_all@_Container_base12@std@@QAEXXZ) 已在 opencv2.obj 中定义

1>MSVCRTD.lib(MSVCR100D.dll) : 错误 LNK2005: __invalid_parameter 已在 LIBCMTD.lib(invarg.obj) 中定义

1>MSVCRTD.lib(MSVCR100D.dll) : 错误 LNK2005: __CrtDbgReportW 已在 LIBCMTD.lib(dbgrptw.obj) 中定义

1>MSVCRTD.lib(MSVCR100D.dll) : 错误 LNK2005: "public: __thiscall std::exception::exception(char const * const &)" (??0exception@std@@QAE@ABQBD@Z) 已经定义在LIBCMTD.lib(stdexcpt.obj)

1>MSVCRTD.lib(MSVCR100D.dll) : 错误 LNK2005: "public: virtual __thiscall std::exception::~exception(void)" (??1exception@std@@UAE@XZ) 已经在 LIBCMTD.lib( stdexcpt.obj)

1>MSVCRTD.lib(MSVCR100D.dll) : 错误 LNK2005: _fclose 已在 LIBCMTD.lib(fclose.obj) 中定义

1>MSVCRTD.lib(MSVCR100D.dll) : 错误 LNK2005: _fprintf 已在 LIBCMTD.lib(fprintf.obj) 中定义

1>MSVCRTD.lib(MSVCR100D.dll) : 错误 LNK2005: _fopen 已在 LIBCMTD.lib(fopen.obj) 中定义

1>MSVCRTD.lib(MSVCR100D.dll) : 错误 LNK2005: _memmove 已在 LIBCMTD.lib(memmove.obj) 中定义

1>MSVCRTD.lib(MSVCR100D.dll) : 错误 LNK2005: _free 已在 LIBCMTD.lib(dbgfree.obj) 中定义

任何建议,将不胜感激。我真的卡在这里了,小程序没有问题

谢谢

PS我也使用来自cvBlobslib的函数和来自LIBSVM的代码,但这不应该是问题

4

1 回答 1

1

如果您更改为使用/MTand /MTd,那么您的所有依赖库也需要使用这些设置进行编译。

如果不是这种情况,那么这些依赖项需要链接到动态 CRT,并且您的项目正在尝试链接到静态 CRT,从而导致您看到“已定义”错误。

于 2012-04-27T10:49:05.270 回答