0

我正在尝试从 Boost:Asio 教程中运行一些基本的服务器/客户端软件。该应用程序在 linux 机器上运行良好,但是当我尝试在我的 windows 机器(mingw)上编译代码时,我无法链接 boost_system 库。

g++ -IC:\boost_1_52_0\include\boost server.cpp -o server.exe -lpthread -lboost_system

如何在我的 Windows 框中链接 boost_system?

错误:

c:\Users\me\Documents\cpp\asioTest>g++ -I C:\boost_1_52_0\include\boost-1_52\ asioServer.cpp -lboost_system

In file included from C:\boost_1_52_0\include\boost-1_52/boost/asio/basic_datagram_socket.hpp:18:0,
             from C:\boost_1_52_0\include\boost-1_52/boost/asio.hpp:20,
             from asioServer.cpp:15:
C:\boost_1_52_0\include\boost-1_52/boost/asio/detail/config.hpp:205:5: warning:
#warning Please define _WIN32_WINNT or _WIN32_WINDOWS appropriately. [-Wcpp]
C:\boost_1_52_0\include\boost-1_52/boost/asio/detail/config.hpp:206:5: warning:
#warning For example, add -D_WIN32_WINNT=0x0501 to the compiler command line. [-Wcpp]
C:\boost_1_52_0\include\boost-1_52/boost/asio/detail/config.hpp:207:5: warning:
#warning Assuming _WIN32_WINNT=0x0501 (i.e. Windows XP target). [-Wcpp]
c:/mingw/bin/../lib/gcc/mingw32/4.7.2/../../../../mingw32/bin/ld.exe: cannot find -lboost_system
collect2.exe: error: ld returned 1 exit status
4

0 回答 0