windows - Why do I get LNK4098 conflicts with use of other libs - when trying to compile C++ in MSVS2010 Express? -
my program not compile in /mt (multithreaded) mode. compiles in /md (multithreaded dll). want able use both libcurl , boost in application distribute installer.
compiling in: msvs2010
this code replicate problem:
#include "stdafx.h" #include "boost/regex.hpp" #include "curl/curl.h" int _tmain(int argc, _tchar* argv[]) { curl *curl; curl = curl_easy_init(); return 0; }
this warning if in /md mode:
link : warning lnk4098: defaultlib 'msvcrtd' conflicts use of other libs; use /nodefaultlib:library
if try compiling in /mt mode get:
1>msvcrtd.lib(msvcr100d.dll) : error lnk2005: _calloc defined in libcmt.lib(calloc.obj) 1>msvcrtd.lib(msvcr100d.dll) : error lnk2005: _realloc defined in libcmt.lib(realloc.obj) 1>msvcrtd.lib(msvcr100d.dll) : error lnk2005: _free defined in libcmt.lib(free.obj) 1>msvcrtd.lib(msvcr100d.dll) : error lnk2005: _malloc defined in libcmt.lib(malloc.obj) 1>msvcrtd.lib(msvcr100d.dll) : error lnk2005: _strtoul defined in libcmt.lib(strtol.obj) 1>msvcrtd.lib(msvcr100d.dll) : error lnk2005: _memmove defined in libcmt.lib(memmove.obj) 1>msvcrtd.lib(msvcr100d.dll) : error lnk2005: _tolower defined in libcmt.lib(tolower.obj) 1>msvcrtd.lib(msvcr100d.dll) : error lnk2005: _strtol defined in libcmt.lib(strtol.obj) ... : fatal error lnk1169: 1 or more multiply defined symbols found
i want compile in /mt mode others can run finished program out having msvs installed or needing download additional. can include , dll or lib files needed app in installer.
i disable loading 'msvcrtd' default library, compiling boost fails.
these preprocessor definitions:
win32 _debug _console building_libcurl http_only
these additional dependencies:
libcurl.lib ws2_32.lib winmm.lib wldap32.lib
does know doing wrong?
thanks, william
try setting nodefaultlib:libcmt.lib
in linker options in vc.
Comments
Post a Comment