1>------ 已启动生成: 项目: torrent_server, 配置: Debug x64 ------
1> main.cpp
1>E:\torrent_server\libtorrent\include\libtorrent/alert.hpp(155): warning C4800: “const uint32_t”: 将值强制为布尔值“true”或“false”(性能警告)
1>E:\torrent_server\libtorrent\include\libtorrent/lazy_entry.hpp(216): warning C4244: “=”: 从“__int64”转换到“uint32_t”,可能丢失数据
1>E:\torrent_server\libtorrent\include\libtorrent/policy.hpp(365): warning C4267: “return”: 从“size_t”转换到“int”,可能丢失数据
1>E:\torrent_server\libtorrent\include\libtorrent/hasher.hpp(114): warning C4267: “参数”: 从“size_t”转换到“int”,可能丢失数据
1>E:\torrent_server\libtorrent\include\libtorrent/bitfield.hpp(54): warning C4267: “参数”: 从“size_t”转换到“int”,可能丢失数据
1>E:\torrent_server\libtorrent\include\libtorrent/bitfield.hpp(121): warning C4267: “参数”: 从“size_t”转换到“int”,可能丢失数据
1> asio.cpp
1> 正在生成代码...
1>libtorrent.lib(asio.obj) : error LNK2005: "class boost::system::error_category const & __cdecl boost::asio::error::get_misc_category(void)" (?get_misc_category@error@asio@boost@@YAAEBVerror_category@system@3@XZ) 已经在 asio.obj 中定义
1>libtorrent.lib(asio.obj) : error LNK2005: "unsigned long __cdecl boost::asio::detail::win_tss_ptr_create(void)" (?win_tss_ptr_create@detail@asio@boost@@YAKXZ) 已经在 asio.obj 中定义
1>libtorrent.lib(asio.obj) : error LNK2005: "void * __cdecl boost::asio::asio_handler_allocate(unsigned __int64,...)" (?asio_handler_allocate@asio@boost@@YAPEAX_KZZ) 已经在 asio.obj 中定义
1>libtorrent.lib(asio.obj) : error LNK2005: "void __cdecl boost::asio::asio_handler_deallocate(void *,unsigned __int64,...)" (?asio_handler_deallocate@asio@boost@@YAXPEAX_KZZ) 已经在 asio.obj 中定义
1>libtorrent.lib(asio.obj) : error LNK2005: "protected: static void __cdecl boost::asio::detail::winsock_init_base::startup(struct boost::asio::detail::winsock_init_base::data &,unsigned char,unsigned char)" (?startup@winsock_init_base@detail@asio@boost@@KAXAEAUdata@1234@EE@Z) 已经在 asio.obj 中定义
1>libtorrent.lib(asio.obj) : error LNK2005: "protected: static void __cdecl boost::asio::detail::winsock_init_base::manual_startup(struct boost::asio::detail::winsock_init_base::data &)" (?manual_startup@winsock_init_base@detail@asio@boost@@KAXAEAUdata@1234@@Z) 已经在 asio.obj 中定义
1>libtorrent.lib(asio.obj) : error LNK2005: "protected: static void __cdecl boost::asio::detail::winsock_init_base::cleanup(struct boost::asio::detail::winsock_init_base::data &)" (?cleanup@winsock_init_base@detail@asio@boost@@KAXAEAUdata@1234@@Z) 已经在 asio.obj 中定义
1>libtorrent.lib(asio.obj) : error LNK2005: "protected: static void __cdecl boost::asio::detail::winsock_init_base::manual_cleanup(struct boost::asio::detail::winsock_init_base::data &)" (?manual_cleanup@winsock_init_base@detail@asio@boost@@KAXAEAUdata@1234@@Z) 已经在 asio.obj 中定义
1>libtorrent.lib(asio.obj) : error LNK2005: "protected: static void __cdecl boost::asio::detail::winsock_init_base::throw_on_error(struct boost::asio::detail::winsock_init_base::data &)" (?throw_on_error@winsock_init_base@detail@asio@boost@@KAXAEAUdata@1234@@Z) 已经在 asio.obj 中定义
1>libtorrent.lib(asio.obj) : error LNK2005: "public: __cdecl boost::asio::io_service::io_service(void)" (??0io_service@asio@boost@@QEAA@XZ) 已经在 asio.obj 中定义
1>libtorrent.lib(asio.obj) : error LNK2005: "public: __cdecl boost::asio::io_service::io_service(unsigned __int64)" (??0io_service@asio@boost@@QEAA@_K@Z) 已经在 asio.obj 中定义
1>libtorrent.lib(asio.obj) : error LNK2005: "public: __cdecl boost::asio::io_service::~io_service(void)" (??1io_service@asio@boost@@QEAA@XZ) 已经在 asio.obj 中定义
1>libtorrent.lib(asio.obj) : error LNK2005: "public: unsigned __int64 __cdecl boost::asio::io_service::run(void)" (?run@io_service@asio@boost@@QEAA_KXZ) 已经在 asio.obj 中定义
1>libtorrent.lib(asio.obj) : error LNK2005: "public: unsigned __int64 __cdecl boost::asio::io_service::run(class boost::system::error_code &)" (?run@io_service@asio@boost@@QEAA_KAEAVerror_code@system@3@@Z) 已经在 asio.obj 中定义
...
...
...
========== 生成: 成功 0 个,失败 1 个,最新 1 个,跳过 0 个 ==========
解决办法:
原因:
预处理器定义和libtorrent库定义的预处理器不一致
将主程序修改为一致:
WIN32
_DEBUG
_CONSOLE
_WIN32_WINNT=0x0501
WIN32_LEAN_AND_MEAN
_CRT_SECURE_NO_WARNINGS
BOOST_ASIO_ENABLE_CANCELIO
BOOST_ASIO_DYN_LINK
TORRENT_USE_OPENSSL