LINK : warning LNK4098: defaultlib "LIBC" conflicts with use of other libs; use /NODEFAULTLIB:librar
2012-05-06 13:35
627 查看
编译时候发现如下警告,虽然问题不大,但是出现警告多少不舒服,于是搜索了一下。
Linking...
LINK : warning LNK4098: defaultlib "LIBC" conflicts with use of other libs; use /NODEFAULTLIB:library
以下是MSDN上的,具体连接http://msdn.microsoft.com/en-us/library/6wtdswk0%28VS.71%29.aspx
defaultlib 'library ' conflicts with use of other libs; use /NODEFAULTLIB:library
You are trying to link with incompatible libraries.
Note 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 , /ML , /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.
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:
Copy
Linking...
LINK : warning LNK4098: defaultlib "LIBC" conflicts with use of other libs; use /NODEFAULTLIB:library
以下是MSDN上的,具体连接http://msdn.microsoft.com/en-us/library/6wtdswk0%28VS.71%29.aspx
defaultlib 'library ' conflicts with use of other libs; use /NODEFAULTLIB:library
You are trying to link with incompatible libraries.
Note 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 , /ML , /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 |
Copy
/NODEFAULTLIB:libcmt.lib /NODEFAULTLIB:msvcrt.lib /NODEFAULTLIB:libcd.lib /NODEFAULTLIB:libcmtd.lib /NODEFAULTLIB:msvcrtd.lib 上面已给出解决方案 具体动手如下: 方案一:project setting -> link -> Category: input -> Igore Libraries = LIBC.lib 输入时注意当前 Build 是什么版本, libs 之间用“,”隔开。“ Ingore all default libraries ”不能勾选。 方案二:project setting -> link ->project opinion 后面加内容/NODEFAULTLIB:LIBC 两种方案的效果是一样的 /article/2602738.html
相关文章推荐
- LINK : warning LNK4098: defaultlib "LIBC" conflicts with use of other libs; use /NODEFAULTLIB:librar
- LINK : warning LNK4098: defaultlib "LIBC" conflicts with use of other libs; use /NODEFAULTLIB:library
- LINK : warning LNK4098: defaultlib "LIBC" conflicts with use of other libs; use /NODEFAULTLIB:library
- LINK : warning LNK4098: defaultlib "LIBC" conflicts with use of other libs; use /NODEFAULTLIB:librar
- LINK : warning LNK4098: defaultlib "LIBC" conflicts with use of other libs; use /NODEFAULTLIB:library
- vc6.0编译提示LINK : warning LNK4098: defaultlib "LIBCMTD" conflicts with use of other libs;
- LINK : warning LNK4098: defaultlib "LIBCMTD" conflicts with use of other libs; use /NODEFAULTLIB:library
- LINK:warning LINK4098: defaultlib "LIBC" conflicts with use of other libs; use /NODEFAULTLIB:library
- VC 调试小记之--warning LNK4098: defaultlib "LIBC" conflicts with use of other libs; use /NODEFAULTLIB:library
- warning LNK4098: defaultlib "MSVCRT" conflicts with use of other libs; use /NODEFAULTLIB:library
- Warning LNK4098 : defaultlib "library" conflicts with use of other libs; use /NODEFAULTLIB:library
- Warning LNK4098 : defaultlib "library" conflicts with use of other libs; use /NODEFAULTLIB:library
- warning LNK4098: defaultlib "MSVCRT" conflicts with use of other libs; use /NODEFAULTLIB:library
- warning LNK4098: defaultlib "MSVCRTD" conflicts with use of other libs; use /NODEFAULTLIB:library
- warning LNK4098: defaultlib "MSVCRT" conflicts with use of other libs; use /NODEFAULTLIB:library
- warning LNK4098: defaultlib "LIBCD" conflicts with use of other libs; use /N
- warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs; use /NODEFAULTLIB:library
- defaultlib "library" conflicts with use of other libs; use /NODEFAULTLIB:library
- LINK : warning LNK4098: defaultlib "mfc42.lib" conflicts with use of other libs; use /NODEFAULTLIB:library
- warning LNK4098: defaultlib "MSVCRT" conflicts with use of other libs; use /NODEFAULTLIB:library