我在尝试使用__sync_add_and_fetch时遇到了错误:
test8.cpp:(.text+0x90e): undefined reference to `__sync_add_and_fetch_8'
collect2: ld returned 1 exit status
请问如何纠正这个问题。
规格: GCC/G++: 4.4.1 GNU/Linux 2.6.32 SMP i686
非常感谢!
编辑: 除了提供的答案,还可以使用-march=i586或-march=i686来成功链接。
注意:这需要GCC/G++ 4.1.x及以上版本!