簡體   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