Site icon 时鹏亮的Blog

error LNK2005: __cinit already defined in Libcmt.lib(crt0dat.obj) 解决办法

请知悉:本文最近一次更新为 5年 前,文中内容可能已经过时。

易语言编译报错提示:

LIBC.lib(crt0dat.obj) : error LNK2005: __cinit already defined in Libcmt.lib(crt0dat.obj)
LIBC.lib(crt0dat.obj) : error LNK2005: _exit already defined in Libcmt.lib(crt0dat.obj)
LIBC.lib(crt0dat.obj) : error LNK2005: __exit already defined in Libcmt.lib(crt0dat.obj)
LIBC.lib(crt0dat.obj) : error LNK2005: __cexit already defined in Libcmt.lib(crt0dat.obj)
LIBC.lib(crt0dat.obj) : error LNK2005: __c_exit already defined in Libcmt.lib(crt0dat.obj)
LIBC.lib(crt0dat.obj) : error LNK2005: __C_Exit_Done already defined in Libcmt.lib(crt0dat.obj)
LIBC.lib(crt0dat.obj) : error LNK2005: __C_Termination_Done already defined in Libcmt.lib(crt0dat.obj)
LIBC.lib(crt0dat.obj) : error LNK2005: __exitflag already defined in Libcmt.lib(crt0dat.obj)
LIBC.lib(crt0dat.obj) : error LNK2005: __wpgmptr already defined in Libcmt.lib(crt0dat.obj)
LIBC.lib(crt0dat.obj) : error LNK2005: __pgmptr already defined in Libcmt.lib(crt0dat.obj)
LIBC.lib(crt0dat.obj) : error LNK2005: ___winitenv already defined in Libcmt.lib(crt0dat.obj)
LIBC.lib(crt0dat.obj) : error LNK2005: __wenviron already defined in Libcmt.lib(crt0dat.obj)
LIBC.lib(crt0dat.obj) : error LNK2005: ___initenv already defined in Libcmt.lib(crt0dat.obj)
LIBC.lib(crt0dat.obj) : error LNK2005: __environ already defined in Libcmt.lib(crt0dat.obj)
LIBC.lib(crt0dat.obj) : error LNK2005: ___wargv already defined in Libcmt.lib(crt0dat.obj)
LIBC.lib(crt0dat.obj) : error LNK2005: ___argv already defined in Libcmt.lib(crt0dat.obj)
LIBC.lib(crt0dat.obj) : error LNK2005: ___argc already defined in Libcmt.lib(crt0dat.obj)
LIBC.lib(crt0dat.obj) : error LNK2005: __winminor already defined in Libcmt.lib(crt0dat.obj)
LIBC.lib(crt0dat.obj) : error LNK2005: __winmajor already defined in Libcmt.lib(crt0dat.obj)
LIBC.lib(crt0dat.obj) : error LNK2005: __winver already defined in Libcmt.lib(crt0dat.obj)
LIBC.lib(crt0dat.obj) : error LNK2005: __osver already defined in Libcmt.lib(crt0dat.obj)
LIBC.lib(crt0dat.obj) : error LNK2005: __umaskval already defined in Libcmt.lib(crt0dat.obj)
LIBC.lib(crt0dat.obj) : warning LNK4006: __cinit already defined in Libcmt.lib(crt0dat.obj); second definition ignored
LIBC.lib(crt0dat.obj) : warning LNK4006: _exit already defined in Libcmt.lib(crt0dat.obj); second definition ignored
LIBC.lib(crt0dat.obj) : warning LNK4006: __exit already defined in Libcmt.lib(crt0dat.obj); second definition ignored
LIBC.lib(crt0dat.obj) : warning LNK4006: __cexit already defined in Libcmt.lib(crt0dat.obj); second definition ignored
LIBC.lib(crt0dat.obj) : warning LNK4006: __c_exit already defined in Libcmt.lib(crt0dat.obj); second definition ignored
LIBC.lib(crt0dat.obj) : warning LNK4006: __C_Exit_Done already defined in Libcmt.lib(crt0dat.obj); second definition ignored
LIBC.lib(crt0dat.obj) : warning LNK4006: __C_Termination_Done already defined in Libcmt.lib(crt0dat.obj); second definition ignored
LIBC.lib(crt0dat.obj) : warning LNK4006: __exitflag already defined in Libcmt.lib(crt0dat.obj); second definition ignored
LIBC.lib(crt0dat.obj) : warning LNK4006: __wpgmptr already defined in Libcmt.lib(crt0dat.obj); second definition ignored

查了一下,原因是:libc.lib 和 libcmt.lib有符号冲突,libcmt.lib已经包含了libc.lib的函数。

解决办法:修改易语言安装目录下的tools文件夹下的link.ini,尾部添加:

extra_args=/NODEFAULTLIB:LIBC.LIB

之后即可正常静态编译。


如您从本文得到了有价值的信息或帮助,请考虑扫描文末二维码捐赠和鼓励。

尊重他人劳动成果。转载请务必附上原文链接,我将感激不尽。


与《error LNK2005: __cinit already defined in Libcmt.lib(crt0dat.obj) 解决办法》相关的博文:

Exit mobile version