LINK : warning LNK4098: defaultlib "LIBCMTD" conflicts with use of other libs; use /NODEFAULTLIB:library
multithreaded)
and
tried
to
link
them,
you’ll get
this
warning.
You
should
compile
all
source
files
to
use
the
same
run-time
library.
例如编译Release版本的单线程的工程,在linker的命令行加入如下的参数:
NODEFAULTLIB:libcmt.lib
/
NODEFAULTLIB:msvcrt.lib
/
NODEFAULTLIB:libcd.lib
/
NODEFAULTLIB:
libcmtd.lib
/
NODEFAULTLIB:msvcrtd.lib
当然,通过VC6.0的开发环境也可以配置。选择Project ->
Setting,出现Project
Setting对话框,单击Link标签,在Category下拉菜单中选择Input,在下方的Ignore
libraries:
输入框中输入“被忽略的
library”框中对应的
libs。输入时注意当前Build是什么版本,
libs之间用“,”隔开。“Ingore
all
default
libraries”不能勾选。
MSDN上的解释为:
You
are
trying
to
link
with
incompatible
libraries.
Important
The
run-time
libraries
now
contain
directives
to
prevent
mixing
different
types.
You’ll
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
总之,lib之间有冲突。需要删除导入的一些
libs。
版 本 | 类 型 | 使用的library | 被忽略的library |
Release | 单线程 | libc.lib | libcmt.lib, |
多线程 | libcmt.lib | libc.lib, | |
使用DLL的多线程 | msvcrt.lib | libc.lib, | |
Debug | 单线程 | libcd.lib | libc.lib, |
多线程 | libcmtd.lib | libc.lib, | |
使用DLL的多线程 | msvcrtd.lib | libc.lib, |
当然,通过VC6.0的开发环境也可以配置。选择Project