1

I'm trying to get boost::asio work.

I've built the boost with command

bjam toolset=gcc --build-type=complete --with-system --with-thre
ad --with-date_time --with-regex --with-serialization stage

My libboost_system file is called libboost_system-mgw47-1_53.dll. So I tried to compile an example program with command (tried both with slashes and back-slashes)

mingw32-g++ -ID:/boost_1_53_0 -LD:/boost_1_53_0/bin.v2/libs
main.cpp -libboost_system-mgw47-1_53

But I continue getting an error

ld.exe: cannot find -libboost_system-mgw47-1_53

The library file is present: D:\boost_1_53_0\bin.v2\libs\system\build\gcc-mingw-4.7.2\release\libboost_system-mgw47-1_53.dll. What I'm doing wrong? I tell the compiler where to look for binaries. Why can't it find them?

P.S. building on a x64 Win7 with mingw 4.7

4

2 回答 2

1

你需要使用:

mingw32-g++ -ID:/boost_1_53_0 -LD:/boost_1_53_0/stage/lib main.cpp -lboost_system-mgw47-1_53
于 2013-06-11T18:58:09.297 回答
1

链接器找不到库文件,因为-L选项不搜索子目录中的文件。

一种可能的解决方案是指定库目录的完整路径-LD:\boost_1_53_0\bin.v2\libs\system\build\gcc-mingw-4.7.2\release

另一个——指定库文件本身的完整路径D:\boost_1_53_0\bin.v2\libs\system\build\gcc-mingw-4.7.2\release\libboost_system-mgw47-1_53.dll-libboost_system-mgw47-1_53在这种情况下不需要。

最正确的是@cv_and_he

于 2013-06-13T05:07:47.183 回答