【问题标题】:installation & compilation boost on ManjaroManjaro 上的安装和编译提升
【发布时间】:2021-07-06 13:09:39
【问题描述】:

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

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

【问题讨论】:

  • 你使用的是什么版本的 GCC?
  • 查看这个关于如何configure your compiler to output errors in english 的问题。这可能会让您更快地得到更好的答案,因为更多的人将能够理解错误。
  • 我正在使用 gcc 11.1.0,感谢@He3lixxx 的建议

标签: c++ installation boost compilation manjaro


【解决方案1】:

我在other question 中找到了答案。

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

感谢您的回答。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-04-14
    • 2020-07-11
    • 2019-05-20
    • 2019-03-08
    • 1970-01-01
    • 1970-01-01
    • 2021-12-20
    • 1970-01-01
    相关资源
    最近更新 更多