牵着老婆满街逛

严以律己,宽以待人. 三思而后行.
GMail/GTalk: yanglinbo#google.com;
MSN/Email: tx7do#yahoo.com.cn;
QQ: 3 0 3 3 9 6 9 2 0 .

编译错误"MSVCRTD.lib(MSVCRTD.dll):errorLNK200

				
今天在编译vc工程时出现的错误,并在网上找到了解决方法,有类似问题的请参照
本人在编译VC6.0工程时,遇到如下错误:
MSVCRTD.lib(MSVCRTD.dll)   :   error   LNK2005:   _getenv   already   defined   in   LIBCMTD.lib(getenv.obj)
MSVCRTD.lib(MSVCRTD.dll)   :   error   LNK2005:   _free   already   defined   in   LIBCMTD.lib(dbgheap.obj)
MSVCRTD.lib(MSVCRTD.dll)   :   error   LNK2005:   _calloc   already   defined   in   LIBCMTD.lib(dbgheap.obj)
MSVCRTD.lib(MSVCRTD.dll)   :   error   LNK2005:   _malloc   already   defined   in   LIBCMTD.lib(dbgheap.obj)
MSVCRTD.lib(MSVCRTD.dll)   :   error   LNK2005:   _printf   already   defined   in   xlibgui.lib(PRINTF.OBJ)
MSVCRTD.lib(MSVCRTD.dll)   :   error   LNK2005:   _fflush   already   defined   in   LIBCMTD.lib(fflush.obj)
MSVCRTD.lib(MSVCRTD.dll)   :   error   LNK2005:   _sprintf   already   defined   in   LIBCMTD.lib(sprintf.obj)
MSVCRTD.lib(MSVCRTD.dll)   :   error   LNK2005:   _strncpy   already   defined   in   LIBCMTD.lib(strncpy.obj)
MSVCRTD.lib(MSVCRTD.dll)   :   error   LNK2005:   _atoi   already   defined   in   LIBCMTD.lib(atox.obj)
MSVCRTD.lib(MSVCRTD.dll)   :   error   LNK2005:   _realloc   already   defined   in   LIBCMTD.lib(dbgheap.obj)
MSVCRTD.lib(MSVCRTD.dll)   :   error   LNK2005:   _signal   already   defined   in   LIBCMTD.lib(winsig.obj)
MSVCRTD.lib(MSVCRTD.dll)   :   error   LNK2005:   __controlfp   already   defined   in   LIBCMTD.lib(ieee87.obj)
MSVCRTD.lib(MSVCRTD.dll)   :   error   LNK2005:   _exit   already   defined   in   LIBCMTD.lib(crt0dat.obj)
MSVCRTD.lib(MSVCRTD.dll)   :   warning   LNK4006:   _getenv   already   defined   in   LIBCMTD.lib(getenv.obj);   second   definition   ignored
MSVCRTD.lib(MSVCRTD.dll)   :   warning   LNK4006:   _free   already   defined   in   LIBCMTD.lib(dbgheap.obj);   second   definition   ignored
MSVCRTD.lib(MSVCRTD.dll)   :   warning   LNK4006:   _calloc   already   defined   in   LIBCMTD.lib(dbgheap.obj);   second   definition   ignored
MSVCRTD.lib(MSVCRTD.dll)   :   warning   LNK4006:   _malloc   already   defined   in   LIBCMTD.lib(dbgheap.obj);   second   definition   ignored
MSVCRTD.lib(MSVCRTD.dll)   :   warning   LNK4006:   _printf   already   defined   in   xlibgui.lib(PRINTF.OBJ);   second   definition   ignored
MSVCRTD.lib(MSVCRTD.dll)   :   warning   LNK4006:   _fflush   already   defined   in   LIBCMTD.lib(fflush.obj);   second   definition   ignored
MSVCRTD.lib(MSVCRTD.dll)   :   warning   LNK4006:   _sprintf   already   defined   in   LIBCMTD.lib(sprintf.obj);   second   definition   ignored
MSVCRTD.lib(MSVCRTD.dll)   :   warning   LNK4006:   _strncpy   already   defined   in   LIBCMTD.lib(strncpy.obj);   second   definition   ignored
MSVCRTD.lib(MSVCRTD.dll)   :   warning   LNK4006:   _atoi   already   defined   in   LIBCMTD.lib(atox.obj);   second   definition   ignored
MSVCRTD.lib(MSVCRTD.dll)   :   warning   LNK4006:   _realloc   already   defined   in   LIBCMTD.lib(dbgheap.obj);   second   definition   ignored
MSVCRTD.lib(MSVCRTD.dll)   :   warning   LNK4006:   _signal   already   defined   in   LIBCMTD.lib(winsig.obj);   second   definition   ignored
MSVCRTD.lib(MSVCRTD.dll)   :   warning   LNK4006:   __controlfp   already   defined   in   LIBCMTD.lib(ieee87.obj);   second   definition   ignored
MSVCRTD.lib(MSVCRTD.dll)   :   warning   LNK4006:   _exit   already   defined   in   LIBCMTD.lib(crt0dat.obj);   second   definition   ignored
MSVCRTD.lib(MSVCRTD.dll)   :   warning   LNK4006:   _fclose   already   defined   in   LIBCMTD.lib(fclose.obj);   second   definition   ignored
MSVCRTD.lib(MSVCRTD.dll)   :   warning   LNK4006:   _fopen   already   defined   in   LIBCMTD.lib(fopen.obj);   second   definition   ignored
MSVCRTD.lib(MSVCRTD.dll)   :   warning   LNK4006:   __stricmp   already   defined   in   LIBCMTD.lib(stricmp.obj);   second   definition   ignored
MSVCRTD.lib(MSVCRTD.dll)   :   warning   LNK4006:   _fprintf   already   defined   in   LIBCMTD.lib(fprintf.obj);   second   definition   ignored
MSVCRTD.lib(MSVCRTD.dll)   :   warning   LNK4006:   _ceil   already   defined   in   LIBCMTD.lib(ceil.obj);   second   definition   ignored
      Creating   library   Debug/shm_ext_sim.lib   and   object   Debug/shm_ext_sim.exp
LINK   :   warning   LNK4098:   defaultlib   "MSVCRTD"   conflicts   with   use   of   other   libs;   use   /NODEFAULTLIB:library
LINK   :   warning   LNK4098:   defaultlib   "MSVCRT"   conflicts   with   use   of   other   libs;   use   /NODEFAULTLIB:library
Debug/shm_ext_sim.exe   :   fatal   error   LNK1169:   one   or   more   multiply   defined   symbols   found
Error   executing   link.exe.

shm_ext_sim.exe   -   37   error(s),   86   warning(s)
 
 
原因及解决方法:
主程序和lib所使用的运行库不一致,project->setting-> Generation->Use MFC Static Library

网友:本站网友时间:2006-08-27 14:24:11 IP地址:202.194.210.★
For example, if you received this warning and you want to create an executable file that uses the non-debug, single-threaded version of the run-time libraries, you could use the following options with the linker:

/NODEFAULTLIB:libcmt.lib /NODEFAULTLIB:msvcrt.lib /NODEFAULTLIB:libcd.lib /NODEFAULTLIB:libcmtd.lib /NODEFAULTLIB:msvcrtd.lib

或者这样:For example, if you received this warning and you want to create an executable file that uses the non-debug, single-threaded version of the run-time libraries, you could use the following options with the linker:

/NODEFAULTLIB:libcmt.lib /NODEFAULTLIB:msvcrt.lib /NODEFAULTLIB:libcd.lib /NODEFAULTLIB:libcmtd.lib /NODEFAULTLIB写程序看到 warning,感觉不爽。 这个警告在 link option 中 加入 对应的 /NODEFAULTLIB:xxx.lib   就ok了




posted on 2006-09-16 17:37 杨粼波 阅读(11873) 评论(9)  编辑 收藏 引用

评论

# re: 编译错误"MSVCRTD.lib(MSVCRTD.dll):errorLNK200 2007-01-18 13:17 我是老小

把LIB重新编译,不要把MFC的DLL做为静态库就OK了  回复  更多评论   

# re: 编译错误"MSVCRTD.lib(MSVCRTD.dll):errorLNK200 2007-06-26 09:18 V086.cn

cl /D"_AFXDLL" /MD /NODEFAULTLIB:msvcrt.lib test0035.cpp可以
cl /NODEFAULTLIB:msvcrt.lib test0035.cpp不可以
/D"_AFXDLL" /MD /NODEFAULTLIB:msvcrt.lib要综合使用,否则怎么也编译不通过,大概是库冲突的原因,具体不是很清楚  回复  更多评论   

# re: 编译错误"MSVCRTD.lib(MSVCRTD.dll):errorLNK200[未登录] 2008-04-16 14:21 杨粼波

貌似还是:
链接器 -> 命令行
里面填写一个/FORCE:MULTIPLE
比较好一点,
不过警告信息依然存在。  回复  更多评论   

# kmjdgcfg 2008-04-17 03:32 kmjdgcfg

yyypaikx http://wiqrlbxg.com agvaseap pihktpba [URL=http://fqcwvddv.com]crgatuam[/URL] <a href="http://bsejbzqu.com">vafciunl</a>   回复  更多评论   

# generic finasteride 2009-08-16 23:23 generic finasteride

Normal is not something to aspire to, it's something to get away from.  回复  更多评论   

# buy fioricet 2009-08-27 20:58 buy fioricet

A billion here, a billion there, pretty soon it adds up to real money.  回复  更多评论   

# intrageneric 2009-08-28 01:14 intrageneric

You have to recognize when the right place and the right time fuse and take advantage of that opportunity. There are plenty of opportunities out there. You can't sit back and wait.  回复  更多评论   

# re: 编译错误"MSVCRTD.lib(MSVCRTD.dll):errorLNK200 2009-11-17 09:41 coloriy

不是那么简单设置吧  回复  更多评论   


只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理