我使用的64位的gcc-4.8.2,以產生一個32位的目標,以及我的機器是64位的。我使用C++ 11併發功能,如線程,互斥,conditiona_variables等未定義參照「__gthrw ___ pthread_key_create(無符號整數*,無效(*)(無效*))
鏈接器試圖將可執行鏈接時給出了上面的錯誤消息。 libMyLib也是該項目的一部分。
libMyLib.so: undefined reference to '__gthrw___pthread_key_create(unsigned int*, void (*)(void*))
nm libMyLib.so | grep的pthread_key_create顯示:
U _ZL28__gthrw___pthread_key_createPjPFvPvE
w [email protected]@GLIBC_2.0
其中是符號 'ghtrw___pthread_key_create'?我嘗試添加'-lpthread(-pthread)'作爲編譯器標誌,但它沒有幫助。
更多信息。 nm libMyLib.so | grep的並行線程示出了其它符號如_ZL20__gthread_mutex_lockP15pthread_mutex_t被定義
'我嘗試添加「-lpthread」作爲編譯器flag' - 你知道關於[正確順序選項(http://stackoverflow.com/questions/18388710/what-is-the-proper-sequence-of-選擇換GCC最重要 - 的 - 即序列)? – Gluttton 2014-12-02 19:53:34
改爲使用'-pthread'編譯器標誌。 – 2014-12-02 19:56:35
添加'-pthread'不能解決我的問題。還有一個問題,缺少符號從哪裏來? – user11869 2014-12-03 18:28:41