2012-07-02 12 views
5

Ich versuche einen kleinen BitTorrent-Client-Befehlszeile mit Rasterbars libtorrent zu erstellen, was von Boost abhängt . Ich habe sowohl die Boost-Bibliotheken gebaut und die libtorrent Bibliothek ihre jeweiligen Richtungen verwenden, aber wenn ich versuche, mein Projekt zu bauen, bekomme ich die folgende Verknüpfung FehlerVS2010 Unresolved Externes Symbol boost :: asio :: detail :: winsock_init_base :: throw_on_error beim Verknüpfen von boost-system mit einem Projekt mit 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 &)" ([email protected][email protected]@[email protected]@@[email protected]@@Z) referenced in function "public: __thiscall boost::asio::detail::winsock_init<2,0>::winsock_init<2,0>(bool)" ([email protected][email protected]@[email protected]@[email protected]@[email protected][email protected]) 
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)" ([email protected][email protected]@[email protected]@@[email protected]@[email protected]) referenced in function "public: __thiscall boost::asio::detail::winsock_init<2,0>::winsock_init<2,0>(bool)" ([email protected][email protected]@[email protected]@[email protected]@[email protected][email protected]) 
1>MiniBT.obj : error LNK2019: unresolved external symbol "class boost::system::error_category const & __cdecl boost::asio::error::get_misc_category(void)" ([email protected]@[email protected]@@[email protected]@[email protected]) referenced in function "void __cdecl boost::asio::error::`dynamic initializer for 'misc_category''(void)" ([email protected]@[email protected]@@YAXXZ) 
1>MiniBT.obj : error LNK2019: unresolved external symbol "unsigned long __cdecl boost::asio::detail::win_tss_ptr_create(void)" ([email protected]@[email protected]@@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)" ([email protected]@[email protected][email protected]@[email protected]@@E[email protected]@[email protected]@@@[email protected]@[email protected]@[email protected]) 
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 &)" ([email protected][email protected]@[email protected]@@[email protected]@@Z) referenced in function "public: __thiscall boost::asio::detail::winsock_init<2,0>::~winsock_init<2,0>(void)" ([email protected][email protected]@[email protected]@[email protected]@[email protected]) 

Es scheint darauf hinzudeuten, dass die asio :: Detail Namespace didn Ich werde nicht in die Boost-System-Bibliothek aufgenommen, da es nur diese 5 Symbole sind, mit denen es ein Problem zu haben scheint und die ansonsten gut mit der Boost-System-Bibliothek verlinkt sind. Ich versuche, eine 32-Bit-Anwendung auf einem 64-Bit-System zu erstellen, aber alles, was ich überprüft habe, scheint dafür richtig konfiguriert zu sein.

Ich weiß, ich vermisse etwas, aber ich kann nicht herausfinden, was. Hat jemand irgendwelche Vorschläge?

+0

Versuchen Sie, BOOST_ASIO_SEPARATE_COMPILATION zu definieren –

+0

Ich habe sowohl BOOST_ASIO_SEPARATE_COMPILATION als auch BOOST_ASIO_DYN_LINK ausprobiert und beide funktionieren nicht. Der einzige Unterschied besteht darin, dass die Fehler __declspec (dllimport) vor den Funktionsdefinitionen enthalten, wenn dyn_link verwendet wird. –

+0

Wie hast du libtorrent erstellt? Welche Version von Libertorrent benutzt du? es scheint, dass Sie nicht gegen die boost.asio-Bibliothek, die als Teil von Libertorrent hätte gebaut werden sollen, in src/asio.cpp – Arvid

Antwort

3

Wenn BOOST_ASIO_SEPARATE_COMPILATION definiert ist, müssen Sie zusätzlich zu #include "boost/asio/ssl/impl/src.hpp" auch "boost/asio/impl/src.hpp" in einer Ihrer cpp-Dateien # einschließen.

+0

Ich hatte das gleiche oder ein ähnliches Problem und das funktionierte. Danke –

Verwandte Themen