我现在的工程使用了第三方库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 ========== 

解决方案 »

  1.   

    这是DLL和lib版本不对应的造成的
      

  2.   

    第一个错误应该是exe和lib所用MFC方式不同的缘故,你的recognizer用的是static MFC,所以某些msvcprtd.lib中的函数集成到了recognizer.lib中,而你的exe用的是share MFC dll,需要从系统找这些函数,当你用exe调用recognizer.lib时这些函数已经在recognizer.lib中存在了,导致冲突.
    一种解决方案就是把exe和lib改为同样的调用MFC的方式,如果你有其他的解决方案,麻烦告诉我一下,我也经常碰到这种头疼的问题。
      

  3.   


    你说的对 本来我的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
      

  4.   

    你说的error是compile时出错还是link时出错?如果还是link时出错那么查一下C/C++-->RunTime Library是不是一致,推荐都用MD.你的程序需要用到MFC的东西吗?(譬如你如果要用CString,Colorref等等类型就必须要用MFC),如果没有用到,强烈推荐都用Use Standard Windows Libraries.
      

  5.   


    linker 出错,Runtime library 都是MDd 我再试下 谢谢
      

  6.   

    http://blog.csdn.net/li_007/archive/2008/08/20/2801781.aspx
    看看这个解决方案,我按照这个解决了我的问题