Chinaunix首页 | 论坛 | 博客
  • 博客访问: 477393
  • 博文数量: 47
  • 博客积分: 2044
  • 博客等级: 上尉
  • 技术积分: 400
  • 用 户 组: 普通用户
  • 注册时间: 2010-10-11 15:50
文章分类

全部博文(47)

文章存档

2012年(1)

2011年(19)

2010年(27)

我的朋友

分类: C/C++

2010-11-17 14:28:41

在Windows XP下编译的软件,放到Windows 2000上使用时,跳出了"无法找到动态链接库MSVCRTD.dll"的提示,后来还是直接将MSVCRTD.dll从WinXP系统目录下copy过来使用来解决问题的。


不过在解决问题过程中,有其他意外收获,现在记下来,说不定以后可参考一二。


刚开始时,我将MFC DLL改为静态库链接,编译,出现如下结果:


MSVCRTD.lib(MSVCRTD.dll) : error LNK2005: _realloc already defined in libcmt.lib(realloc.obj)

MSVCRTD.lib(MSVCRTD.dll) : error LNK2005: _free already defined in libcmt.lib(free.obj)

MSVCRTD.lib(MSVCRTD.dll) : error LNK2005: _malloc already defined in libcmt.lib(malloc.obj)

MSVCRTD.lib(MSVCRTD.dll) : error LNK2005: _strchr already defined in libcmt.lib(strchr.obj)

MSVCRTD.lib(MSVCRTD.dll) : error LNK2005: _sprintf already defined in libcmt.lib(sprintf.obj)

MSVCRTD.lib(MSVCRTD.dll) : error LNK2005: _tolower already defined in libcmt.lib(tolower.obj)

MSVCRTD.lib(MSVCRTD.dll) : error LNK2005: _getenv already defined in libcmt.lib(getenv.obj)

MSVCRTD.lib(MSVCRTD.dll) : error LNK2005: _toupper already defined in libcmt.lib(toupper.obj)

MSVCRTD.lib(MSVCRTD.dll) : error LNK2005: __isctype already defined in libcmt.lib(isctype.obj)

MSVCRTD.lib(MSVCRTD.dll) : error LNK2005: _atoi already defined in libcmt.lib(atox.obj)

MSVCRTD.lib(MSVCRTD.dll) : error LNK2005: _strstr already defined in libcmt.lib(strstr.obj)

MSVCRTD.lib(MSVCRTD.dll) : error LNK2005: _calloc already defined in libcmt.lib(calloc.obj)

MSVCRTD.lib(MSVCRTD.dll) : error LNK2005: _strncpy already defined in libcmt.lib(strncpy.obj)

MSVCRTD.lib(MSVCRTD.dll) : error LNK2005: _strncmp already defined in libcmt.lib(strncmp.obj)

MSVCRTD.lib(MSVCRTD.dll) : error LNK2005: _memmove already defined in libcmt.lib(memmove.obj)

MSVCRTD.lib(MSVCRTD.dll) : error LNK2005: _strtoul already defined in libcmt.lib(strtol.obj)

MSVCRTD.lib(MSVCRTD.dll) : error LNK2005: _strtol already defined in libcmt.lib(strtol.obj)

MSVCRTD.lib(MSVCRTD.dll) : error LNK2005: _fclose already defined in libcmt.lib(fclose.obj)

MSVCRTD.lib(MSVCRTD.dll) : error LNK2005: _ungetc already defined in libcmt.lib(ungetc.obj)

MSVCRTD.lib(MSVCRTD.dll) : error LNK2005: __errno already defined in libcmt.lib(dosmap.obj)

MSVCRTD.lib(MSVCRTD.dll) : error LNK2005: _sscanf already defined in libcmt.lib(sscanf.obj)

MSVCRTD.lib(MSVCRTD.dll) : error LNK2005: _setlocale already defined in libcmt.lib(setlocal.obj)

MSVCRTD.lib(MSVCRTD.dll) : error LNK2005: _printf already defined in libcmt.lib(printf.obj)

MSVCRTD.lib(MSVCRTD.dll) : error LNK2005: _localtime already defined in libcmt.lib(localtim.obj)

MSVCRTD.lib(MSVCRTD.dll) : error LNK2005: _time already defined in libcmt.lib(time.obj)

MSVCRTD.lib(MSVCRTD.dll) : error LNK2005: _fflush already defined in libcmt.lib(fflush.obj)

MSVCRTD.lib(MSVCRTD.dll) : error LNK2005: __strdup already defined in libcmt.lib(strdup.obj)


LINK : warning LNK4098: defaultlib "MSVCRTD" conflicts with use of other libs; use /NODEFAULTLIB:library


..\..\Output\Release/FirewallMan.exe : fatal error LNK1169: one or more multiply defined symbols found


Error executing link.exe.


相信一个善良的人对上面的错误不会熟视无睹的,我的解决方法当然是对症下药:


Link->Category: Input->Ignore libraries:libcmt



clean后重新编译,还有下面的链接错误:


Linking...


nafxcw.lib(appcore.obj) : error LNK2001: unresolved external symbol ___argv

nafxcw.lib(appcore.obj) : error LNK2001: unresolved external symbol ___argc

nafxcw.lib(apphelp.obj) : error LNK2001: unresolved external symbol __mbctype

nafxcw.lib(filelist.obj) : error LNK2001: unresolved external symbol __mbctype

nafxcw.lib(dcprev.obj) : error LNK2001: unresolved external symbol __mbctype

nafxcw.lib(timecore.obj) : error LNK2001: unresolved external symbol __mbctype


..\..\Output\Release/FirewallMan.exe : fatal error LNK1120: 3 unresolved externals


Error executing link.exe.


呵呵,这个错误真厉害,我用google搜索了一下,发现才3页,而且提出问题后后面基本上没有什么解决方法,其中我还硬着头皮看了俄语的链接,但遗憾的是从字面上看没有解答,而后上了微软网站,看到有提问,但是没有回答的。


后来尝试了很多方法,经过摸索,最后得出解决方法:


在Preprocessor中定义_AFXDLL


如果它提示:fatal error C1189: #error : Please use the /MD switch for _AFXDLL builds


就这样改:


C/C++->Code Generation->Multithread DLL (即实现/MD选项)

阅读(1973) | 评论(0) | 转发(0) |
0

上一篇:android sd卡读写

下一篇:文本流和二进制流

给主人留下些什么吧!~~