链接库时出错:libboost_system

时间:2012-12-20 17:48:41

标签: c++ boost g++ mingw boost-asio

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

g ++ -I C:\ 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

0 个答案:

没有答案