我现在的工程使用了第三方库recognizer.lib, recognizer.lib已经在linker->input->additional dependencies中添加;
Runtime library为/MDd, LIBCPMT.LIB,LIBCPMTD.LIB在ignore specific library中添加。 我在网上查找了很久,但是还是没有解决这个问题,出现的错误如下:
1>Linking...
1>msvcprtd.lib(MSVCP90D.dll) : error LNK2005: "public: class std::locale::facet * __thiscall std::locale::facet::_Decref(void)" (?_Decref@facet@locale@std@@QAEPAV123@XZ) already defined in recognizer.lib(CIScribble.obj)
1>LINK : warning LNK4098: defaultlib 'LIBCMTD' conflicts with use of other libs; use /NODEFAULTLIB:library
1>recognizer.lib(CIScribble.obj) : error LNK2001: unresolved external symbol "public: static class std::locale::id std::ctype <char>::id" (?id@?$ctype@D@std@@2V0locale@2@A)
1>recognizer.lib(CIScribble.obj) : error LNK2001: unresolved external symbol "private: static int std::locale::id::_Id_cnt" (?_Id_cnt@id@locale@std@@0HA)
1>.\..\bin/Caligula.exe : fatal error LNK1120: 2 unresolved externals
1>Build log was saved at "file://c:\Documents and Settings\kding\Desktop\CALITEST\app_examples\Caligula\Debug\BuildLog.htm"
1>Caligula - 4 error(s), 18 warning(s)
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========
Runtime library为/MDd, LIBCPMT.LIB,LIBCPMTD.LIB在ignore specific library中添加。 我在网上查找了很久,但是还是没有解决这个问题,出现的错误如下:
1>Linking...
1>msvcprtd.lib(MSVCP90D.dll) : error LNK2005: "public: class std::locale::facet * __thiscall std::locale::facet::_Decref(void)" (?_Decref@facet@locale@std@@QAEPAV123@XZ) already defined in recognizer.lib(CIScribble.obj)
1>LINK : warning LNK4098: defaultlib 'LIBCMTD' conflicts with use of other libs; use /NODEFAULTLIB:library
1>recognizer.lib(CIScribble.obj) : error LNK2001: unresolved external symbol "public: static class std::locale::id std::ctype <char>::id" (?id@?$ctype@D@std@@2V0locale@2@A)
1>recognizer.lib(CIScribble.obj) : error LNK2001: unresolved external symbol "private: static int std::locale::id::_Id_cnt" (?_Id_cnt@id@locale@std@@0HA)
1>.\..\bin/Caligula.exe : fatal error LNK1120: 2 unresolved externals
1>Build log was saved at "file://c:\Documents and Settings\kding\Desktop\CALITEST\app_examples\Caligula\Debug\BuildLog.htm"
1>Caligula - 4 error(s), 18 warning(s)
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========
一种解决方案就是把exe和lib改为同样的调用MFC的方式,如果你有其他的解决方案,麻烦告诉我一下,我也经常碰到这种头疼的问题。
你说的对 本来我的lib用的是static MFC, exe用的是Standard Windows Libraries,当我把exe的use of MFC改为shared MFC,一切就正常了。但是我还有一个问题,我将exe和lib都改为同样的链接方式,exe却只有shared MFC方式可以成功,这是为什么呢? 我的结果如下: USE of MFC recognizer.lib .exeUse Standard Windows Libraries successful error
Use MFC in a Static Library successful error
Use MFC in a Shared DLL successful successful
linker 出错,Runtime library 都是MDd 我再试下 谢谢
看看这个解决方案,我按照这个解决了我的问题