繁体   English   中英

使用Eclipse进行Boost找不到线程库

[英]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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM