c++ - 无法使用 mingw32-g++ 链接 boost

标签 c++ boost compilation mingw linker-errors

我正在尝试让 boost::asio 工作。

我已经用命令构建了 boost

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

我的 libboost_system 文件名为 libboost_system-mgw47-1_53.dll。所以我试着编译了一个例子program使用命令(尝试使用斜杠和反斜杠)

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

但是我继续报错

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

存在库文件:D:\boost_1_53_0\bin.v2\libs\system\build\gcc-mingw-4.7.2\release\libboost_system-mgw47-1_53.dll。我做错了什么?我告诉编译器在哪里寻找二进制文件。为什么找不到它们?

附言使用 mingw 4.7 在 x64 Win7 上构建

最佳答案

你需要使用:

mingw32-g++ -ID:/boost_1_53_0 -LD:/boost_1_53_0/stage/lib main.cpp -lboost_system-mgw47-1_53

关于c++ - 无法使用 mingw32-g++ 链接 boost ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17031185/

相关文章:

c# - 为什么 C# 编译器不能通过 switch 语句跟踪所有代码路径

C 将配置文件绑定(bind)到可执行文件

c - GCC 中的链接错误 : selective static linking of libm. a

c++ - 用一个 int 替换多个 bool 并使用位掩码的性能优势?

c++ - 锁()的实现

c++ - 结构数组 - 初始化错误

c++ - 并发队列内存消耗爆炸,然后程序崩溃

c++ - "cannot find -lQt5Core -lQt5Gui etc"使用其他不相关的库时

C++错误,没有匹配的函数

c++ - 在 cython 中伪造模板