架构x86_64的未定义符号 - 在libboost_thread-mt.a中

时间:2013-12-17 03:11:52

标签: x86-64 boost-thread

 boost::atomics::detail::lockpool::get_lock_for(void const volatile*)", referenced from:
 boost::thread_detail::enter_once_region(boost::once_flag&)   in libboost_thread-mt.a(once.o)
 boost::thread_detail::commit_once_region(boost::once_flag&)   in libboost_thread-mt.a(once.o)
 boost::thread_detail::rollback_once_region(boost::once_flag&)   in libboost_thread-mt.a(once.o)
 ld: symbol(s) not found for architecture x86_64

我正在运行OS X版本10.9。

使用以下选项安装了提升:

sudo port install boost + universal

$ ar -tv libboost_thread-mt.a
rw-r--r--     502/501       21776 Dec  1 22:44 2013 __.SYMDEF
rw-r--r--     502/80       925520 Dec  1 22:44 2013 thread.o
rw-r--r--     502/80        18248 Dec  1 22:44 2013 once.o
rw-r--r--     502/80        51216 Dec  1 22:44 2013 future.o

$ nm -a once.o 
0000000000003168 s EH_frame0
0000000000003080 s GCC_except_table0
00000000000030cc s GCC_except_table1
0000000000003118 s GCC_except_table2
             U __Unwind_Resume
0000000000000000 T __ZN5boost13thread_detail17enter_once_regionERNS_9once_flagE
0000000000003188 S __ZN5boost13thread_detail17enter_once_regionERNS_9once_flagE.eh
0000000000000130 T __ZN5boost13thread_detail18commit_once_regionERNS_9once_flagE
00000000000031c0 S __ZN5boost13thread_detail18commit_once_regionERNS_9once_flagE.eh
00000000000001a0 T __ZN5boost13thread_detail20rollback_once_regionERNS_9once_flagE
00000000000031f0 S __ZN5boost13thread_detail20rollback_once_regionERNS_9once_flagE.eh
0000000000003010 d __ZN5boost13thread_detailL10once_mutexE
0000000000003050 d __ZN5boost13thread_detailL7once_cvE
             U __ZN5boost7atomics6detail8lockpool12get_lock_forEPVKv
             U __ZSt9terminatev
             U ___gxx_personality_v0
             U _pthread_cond_broadcast
             U _pthread_cond_wait
             U _pthread_mutex_lock
             U _pthread_mutex_unlock

可以注意到“U __ZN5boost7atomics6detail8lockpool12get_lock_forEPVKv”这一行

表示未定义get_lock_for。这导致了这个问题。

如何摆脱这个错误。有什么建议吗?

1 个答案:

答案 0 :(得分:0)

链接更多库。 :)

-lboost_atomic特别是get_lock_for