我正在尝试使用Rasterbar的libtorrent构建一个小命令行BitTorrent客户端,这取决于Boost。我使用各自的方向构建了Boost库和libtorrent库,但是当我尝试构建项目时,我得到以下链接错误
1>------ Build started: Project: MiniBT, Configuration: Debug Win32 ------
1>MiniBT.obj : error LNK2019: unresolved external symbol "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@@KAXAAUdata@1234@@Z) referenced in function "public: __thiscall boost::asio::detail::winsock_init<2,0>::winsock_init<2,0>(bool)" (??0?$winsock_init@$01$0A@@detail@asio@boost@@QAE@_N@Z)
1>MiniBT.obj : error LNK2019: unresolved external symbol "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@@KAXAAUdata@1234@EE@Z) referenced in function "public: __thiscall boost::asio::detail::winsock_init<2,0>::winsock_init<2,0>(bool)" (??0?$winsock_init@$01$0A@@detail@asio@boost@@QAE@_N@Z)
1>MiniBT.obj : error LNK2019: unresolved external symbol "class boost::system::error_category const & __cdecl boost::asio::error::get_misc_category(void)" (?get_misc_category@error@asio@boost@@YAABVerror_category@system@3@XZ) referenced in function "void __cdecl boost::asio::error::`dynamic initializer for 'misc_category''(void)" (??__Emisc_category@error@asio@boost@@YAXXZ)
1>MiniBT.obj : error LNK2019: unresolved external symbol "unsigned long __cdecl boost::asio::detail::win_tss_ptr_create(void)" (?win_tss_ptr_create@detail@asio@boost@@YAKXZ) referenced in function "public: __thiscall boost::asio::detail::win_tss_ptr<class boost::asio::detail::call_stack<class boost::asio::detail::win_iocp_io_service,unsigned char>::context>::win_tss_ptr<class boost::asio::detail::call_stack<class boost::asio::detail::win_iocp_io_service,unsigned char>::context>(void)" (??0?$win_tss_ptr@Vcontext@?$call_stack@Vwin_iocp_io_service@detail@asio@boost@@E@detail@asio@boost@@@detail@asio@boost@@QAE@XZ)
1>MiniBT.obj : error LNK2019: unresolved external symbol "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@@KAXAAUdata@1234@@Z) referenced in function "public: __thiscall boost::asio::detail::winsock_init<2,0>::~winsock_init<2,0>(void)" (??1?$winsock_init@$01$0A@@detail@asio@boost@@QAE@XZ)
它似乎表明asio :: detail命名空间没有包含在boost系统库中,因为它只是那些似乎有问题的5个符号,并且它链接到boost系统库就好了。我正在尝试在64位系统上构建一个32位应用程序,但我检查的所有内容似乎都已正确配置。
我知道我错过了什么,但我似乎无法弄清楚是什么。有没有人有任何建议?
答案 0 :(得分:4)
定义了BOOST_ASIO_SEPARATE_COMPILATION,除了#include“boost / asio / ssl / impl / src.hpp”之外,你还必须在你的一个cpp文件中#include“boost / asio / impl / src.hpp”。 / p>