[英]Boost with eclipse cannot find thread library
我已经下载并构建了Boost库
bootstrap mingw
和
b2 toolset=gcc
并且库在
C:\Boost\boost_1_57_0\stage\lib
在eclipse中,我将此目录添加为库路径
并添加了带和不带.a的库libboost_thread-mgw49-mt-1_57
。
g ++行看起来像
g++ "-LC:\\Boost\\boost_1_57_0\\stage\\lib" -o MyThread.exe main.o MyThread.o -llibboost_thread-mgw49-mt-1_57
我收到错误消息
ld.exe: cannot find -llibboost_thread-mgw49-mt-1_57 collect2.exe: error: ld returned 1 exit status
如果添加.a
它将按预期添加到错误消息中。
我究竟做错了什么?
指定不带lib
前缀的库(这是UNIX约定):
g++ "-LC:\Boost\boost_1_57_0\stage\lib" -pthread -o MyThread.exe main.o MyThread.o -libboost_thread-mgw49-mt-1_57
(甚至在一些标准约定符号链接的帮助下)您甚至可能会说-lboost_thread
。
PS别忘了也使用-pthread
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.