Why am I getting LNK4098 conflicts using other libs - when I try to compile C ++ in MSVS2010 Express?

My program will not compile successfully in / MT (MultiThreaded) mode. It compiles to / MD (MultiThreaded DLL). I want to be able to use libcurl and boost in an application that I will distribute using the installer.

Compile to: MSVS2010

This is the code to replicate my 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 is the warning I get in / MD mode:

LINK : warning LNK4098: defaultlib 'MSVCRTD' conflicts with use of other libs; 
use /NODEFAULTLIB:library

If I try to compile in / MT mode, I get:

1>MSVCRTD.lib(MSVCR100D.dll) : error LNK2005: _calloc already defined in 

LIBCMT.lib(calloc.obj)
1>MSVCRTD.lib(MSVCR100D.dll) : error LNK2005: _realloc already defined in LIBCMT.lib(realloc.obj)
1>MSVCRTD.lib(MSVCR100D.dll) : error LNK2005: _free already defined in LIBCMT.lib(free.obj)
1>MSVCRTD.lib(MSVCR100D.dll) : error LNK2005: _malloc already defined in LIBCMT.lib(malloc.obj)
1>MSVCRTD.lib(MSVCR100D.dll) : error LNK2005: _strtoul already defined in LIBCMT.lib(strtol.obj)
1>MSVCRTD.lib(MSVCR100D.dll) : error LNK2005: _memmove already defined in LIBCMT.lib(memmove.obj)
1>MSVCRTD.lib(MSVCR100D.dll) : error LNK2005: _tolower already defined in LIBCMT.lib(tolower.obj)
1>MSVCRTD.lib(MSVCR100D.dll) : error LNK2005: _strtol already defined in LIBCMT.lib(strtol.obj)
...
: fatal error LNK1169: one or more multiply defined symbols found

I want to compile in / MT mode so that others can run my finished program without installing MSVS or to download anything extra. I can include either the dll or lib files needed by my application in the installer.

MSVCRTD , boost .

:

WIN32
_DEBUG
_CONSOLE
BUILDING_LIBCURL
HTTP_ONLY

:

libcurl.lib
ws2_32.lib
winmm.lib
wldap32.lib

- , ?

,

+5
4

nodefaultlib:libcmt.lib VC.

+7

MSVCRT * D * LIBC * MT *.lib

(/MT,/MTD,/MD,/MDD)

+3

_DEBUG (.. ). , , - . , : .

( , .)

+1

libCurl rtlibcfg = static. libCURL/Mt.

0

All Articles