转自:http://blog.csdn.net/magictong/article/details/6105160
LIBC.lib(crt0dat.obj) : error LNK2008: __cinit already defined in libcmt.lib(crt0dat.obj)
LIBC.lib(crt0dat.obj) : error LNK2008: _malloc already defined in libcmt.lib(crt0dat.obj)
LIBC.lib(crt0dat.obj) : error LNK2008: __exit already defined in libcmt.lib(crt0dat.obj)
LIBC.lib(crt0dat.obj) : error LNK2008: __heap—loc-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)
LINK : warning LNK4098: defaultlib "LIBC" conflicts with use of other libs; use /NODEFAULTLIB:library
解决方法:08的设置方法如下图所示:打开工程属性对话框,选择链接下Input,在Ignore Specific Library里面输入要忽略的库即可(有多个 的话用逗号隔开)。另外具体这里的话,如果是release版本要忽略LIBCMT.lib,debug版本要忽略LIBCMTD.lib。

Error Message
defaultlib 'library' conflicts with use of other libs; use /NODEFAULTLIB:library
You are trying to link with incompatible libraries.
|
The run-time libraries now contain directives to prevent mixing different types. You will receive this warning if you try to use different types or debug and non-debug versions of the run-time library in the same program. For example, if you compiled one file to use one kind of run-time library and another file to use another kind (for example, single-threaded versus multithreaded) and tried to link them, you will get this warning. You should compile all source files to use the same run-time library. See the Use Run-Time Library (/MD, /MT, /LD) compiler options for more information. |
You can use the linker's /VERBOSE:LIB switch to determine which libraries the linker is searching. If you receive LNK4098 and want to create an executable file that uses, for example, the single-threaded, non-debug run-time libraries, use the /VERBOSE:LIB option to find out which libraries the linker is searching. The linker should print LIBC.lib and not LIBCMT.lib, MSVCRT.lib, LIBCD.lib, LIBCMTD.lib, or MSVCRTD.lib as the libraries searched. You can tell the linker to ignore the incorrect run-time libraries by using /NODEFAULTLIB for each library you want to ignore.
The table below shows which libraries should be ignored depending on which run-time library you want to use.
| To use this run-time library | Ignore these libraries |
|---|---|
|
Single-threaded (libc.lib) |
libcmt.lib, msvcrt.lib, libcd.lib, libcmtd.lib, msvcrtd.lib |
|
Multithreaded (libcmt.lib) |
libc.lib, msvcrt.lib, libcd.lib, libcmtd.lib, msvcrtd.lib |
|
Multithreaded using DLL (msvcrt.lib) |
libc.lib, libcmt.lib, libcd.lib, libcmtd.lib, msvcrtd.lib |
|
Debug Single-threaded (libcd.lib) |
libc.lib, libcmt.lib, msvcrt.lib, libcmtd.lib, msvcrtd.lib |
|
Debug Multithreaded (libcmtd.lib) |
libc.lib, libcmt.lib, msvcrt.lib, libcd.lib, msvcrtd.lib |
|
Debug Multithreaded using DLL (msvcrtd.lib) |
libc.lib, libcmt.lib, msvcrt.lib, libcd.lib, libcmtd.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:
浙公网安备 33010602011771号