我使用的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