gpt4 book ai didi

c++ - 使用 apt 安装在 Ubuntu 20.04 LTS 上找不到 c++ boost 头文件

转载 作者:行者123 更新时间:2023-12-04 19:26:08 28 4
gpt4 key购买 nike

我刚刚将我的服务器升级到 ubuntu 20.04 LTS。
我现在正在尝试在其上使用各种不同的代码包,并收到与 boost 安装相关的错误。
我没有从源代码构建,而是使用 apt 安装了 boost 1.71.0:

sudo apt-get install libboost-all-dev
但是,当我尝试编译代码时,会出现以下错误:
fatal error: boost/algorithm/string/trim.hpp: No such file or directory
15 | #include <boost/algorithm/string/trim.hpp>
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
boost/log/sinks/text_ostream_backend.hpp: No such file or directory
6 | #include <boost/log/sinks/text_ostream_backend.hpp>
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
我花了过去 3 个小时试图找到那些 hpp 文件,但没有成功。里面什么都没有:
/usr/local/include/
/usr/local/lib/
/usr/lib/
/usr/include/boost *doesn't exist*
知道有什么问题吗?
我试图避免从源代码而不是 Ubuntu 软件包安装 boost,但我必须这样做吗?

最佳答案

设法解决了这个问题。
事实证明,因为我之前通过手动安装进行了 boost 安装(在升级到 20.04 LTS 之前)并手动删除了这些文件,所以通过 apt 进一步重新安装并没有重新创建 usr/include/ 中的文件,由于系统中仍然安装了其他与 boost 相关的软件包。
恢复运行 apt list --installed '*boost*'然后卸载任何这些链接的包。
之后运行 sudo apt install libboost-all-dev使用所有头文件重新创建/usr/include/boost 目录。
此过程已在以下答案中列出:https://askubuntu.com/questions/1161393/i-deleted-usr-include-boost-installing-libboost-all-dev-wont-bring-headers-ba

关于c++ - 使用 apt 安装在 Ubuntu 20.04 LTS 上找不到 c++ boost 头文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/70858122/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com