c++ - Boost undefined references交叉编译linux到windows

标签 c++ linux windows boost cross-compiling

我正在尝试使用 boost 从 linux 交叉编译到 windows。我已经交叉编译了 boost 并且我有 DLL,但是当我链接时,我得到了几个 undefined reference :

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

src/client/CommunicationHandler.o:CommunicationHandler.cpp:(.text+0x1b7): undefined reference to boost::asio::ip::address_v4::from_string(std::__cxx11::basic_string, std::allocator > const&)'

src/client/CommunicationHandler.o:CommunicationHandler.cpp:(.text+0x1c7): undefined reference to 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): undefined reference to `boost::asio::io_service::run()'

src/client/CommunicationHandler.o:CommunicationHandler.cpp:(.text$_ZN5boost4asio2ip14basic_endpointINS1_3tcpEEC1ERKNS1_7addressEt[_ZN5boost4asio2ip14basic_endpointINS1_3tcpEEC1ERKNS1_7addressEt]+0x2a): undefined reference to boost::asio::ip::detail::endpoint::endpoint(boost::asio::ip::address const&, unsigned short)'

src/client/CommunicationHandler.o:CommunicationHandler.cpp:(.text$_ZN5boost4asio2ip16resolver_serviceINS1_3tcpEE7destroyERSt10shared_ptrIvE[_ZN5boost4asio2ip16resolver_serviceINS1_3tcpEE7destroyERSt10shared_ptrIvE]+0x20): undefined reference to boost::asio::detail::resolver_service_base::destroy(std::shared_ptr&)'

...等等

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

最佳答案

这使它有效

#ifndef BOOST_SYSTEM_USE_LIB # 定义 BOOST_SYSTEM_USE_LIB #endif

关于c++ - Boost undefined references交叉编译linux到windows,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40557739/

相关文章:

c++ - 如何使用 FFMPEG 打开文件\实时流使用 openCV 编辑每个帧并将其保存为使用 FFMPEG 文件\实时流编码?

linux - vmware fusion端口在虚拟机之间转发

python - ubuntu 16.04上安装CartoDB gdal编译报错

c++ - 如何在 C++ 中将 PWSTR 转换为字符串?

c++ - 在 C++ 中为 vector 容器重载 [] 运算符时, undefined index 返回什么?

C++ 裸指针作用域

linux - 为什么 `su`一直问我密码

windows - 使用 Let's Encrypt 无法在 IIS 中解析 SSL

c# - 如何使用 ReflectionPermission 拒绝反射

c++ - 是否可以使用另一个 cpp 文件中定义的类而不是任何 header ?