Wil*_*ell 6 c++ windows installer linker visual-studio
我的程序无法在/ MT(MultiThreaded)模式下成功编译.它在/ MD(MultiThreaded DLL)中编译.我希望能够在我将使用安装程序分发的应用程序中同时使用libcurl和boost.
编译于:MSVS2010
这是复制我的问题的代码:
#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;
}
Run Code Online (Sandbox Code Playgroud)
如果处于/ MD模式,这是我得到的警告:
LINK : warning LNK4098: defaultlib 'MSVCRTD' conflicts with use of other libs;
use /NODEFAULTLIB:library
Run Code Online (Sandbox Code Playgroud)
如果我尝试在/ MT模式下编译,我得到:
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
Run Code Online (Sandbox Code Playgroud)
我想在/ MT模式下编译,以便其他人可以在没有安装MSVS或需要下载任何其他内容的情况下运行我已完成的程序.我可以在安装程序中包含我的应用程序所需的dll或lib文件.
我可以禁用加载'MSVCRTD'默认库,但是然后编译with boost失败.
这些是我的预处理器定义:
WIN32
_DEBUG
_CONSOLE
BUILDING_LIBCURL
HTTP_ONLY
Run Code Online (Sandbox Code Playgroud)
这些是我的附加依赖项:
libcurl.lib
ws2_32.lib
winmm.lib
wldap32.lib
Run Code Online (Sandbox Code Playgroud)
有谁知道我做错了什么?
谢谢,威廉
| 归档时间: |
|
| 查看次数: |
8178 次 |
| 最近记录: |