Manjaro 上的安装和编译提升

installation & compilation boost on Manjaro

我使用 pacman -S boost boost-libs 安装了 boost。 当我尝试编译使用 boost::thread 的程序时,出现以下错误:

/usr/bin/ld: /tmp/cc3AkelG.o: warning: relocation against `_ZTVN5boost6detail16thread_data_baseE' in read-only section `.text._ZN5boost6detail16thread_data_baseC2Ev[_ZN5boost6detail16thread_data_baseC5Ev]'
/usr/bin/ld: warning: creating DT_TEXTREL in a PIE
collect2: error: ld returned 1 exit status

为什么会发生这种情况,我该如何解决?

我在 other question 中找到了答案。

我必须使用 -pthread -lboost_thread 进行编译。

感谢您的回答。