【问题标题】:Boost undefined references cross compiling linux to windows提升未定义的引用交叉编译linux到windows
【发布时间】:2017-03-26 06:14:37
【问题描述】:

我正在尝试使用 boost 从 linux 交叉编译到 windows。我已经交叉编译了 boost 并且我确实有 DLL,但是当我链接时,我得到了几个未定义的引用:

src/client/CommunicationHandler.o:CommunicationHandler.cpp:(.text+0x170): 对`boost::asio::io_service::io_service()'的未定义引用

src/client/CommunicationHandler.o:CommunicationHandler.cpp:(.text+0x1b7): 对 boost::asio::ip::address_v4::from_string(std::__cxx11::basic_string, std:: 的未定义引用分配器 > const&)'

src/client/CommunicationHandler.o:CommunicationHandler.cpp:(.text+0x1c7): 对 boost::asio::ip::address::address(boost::asio::ip::address_v4 const& 的未定义引用)'

src/client/CommunicationHandler.o:CommunicationHandler.cpp:(.text+0x54e): undefined reference to `boost::asio::io_service::~io_service()'

src/client/CommunicationHandler.o:CommunicationHandler.cpp:(.text+0x5c0): undefined reference to `boost::asio::io_service::~io_service()'

src/client/CommunicationHandler.o:CommunicationHandler.cpp:(.text+0x97e): 对`boost::asio::io_service::run()'的未定义引用

src/client/CommunicationHandler.o:CommunicationHandler.cpp:(.text$_ZN5boost4asio2ip14basic_endpointINS1_3tcpEEC1ERKNS1_7addressEt[_ZN5boost4asio2ip14basic_endpointINS1_3tcpEEC1ERKNS1_7addressEt]+0x2a): 对 boost::asio::ip::boost:::endpoint 的未定义引用asio::ip::address const&, unsigned short)'

的src /客户端/ CommunicationHandler.o:CommunicationHandler.cpp :(文本$ _ZN5boost4asio2ip16resolver_serviceINS1_3tcpEE7destroyERSt10shared_ptrIvE [_ZN5boost4asio2ip16resolver_serviceINS1_3tcpEE7destroyERSt10shared_ptrIvE] + 0×20):未定义参照升压:: ASIO ::详细:: resolver_service_base ::破坏(STD :: shared_ptr的&)”

...等

为什么符号不在 DLL 中?我该怎么做才能使其正确链接?

【问题讨论】:

    标签: c++ linux windows boost cross-compiling


    【解决方案1】:

    这使它起作用

    #ifndef BOOST_SYSTEM_USE_LIB # 定义 BOOST_SYSTEM_USE_LIB #endif

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-01-27
      • 2016-03-26
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多