即使安装了boost,boost_filesystemConfig.cmake文件也不存在

问题描述 投票:0回答:1

我目前正在尝试使用 CMake 编译一些 C++ 代码,这需要 boost 库。我在 WSL 上使用 Ubuntu 18.04,并使用以下教程 1 安装了 boost 1.77。我知道它可以工作,因为我已经使用 g++ 成功编译了示例。我需要使用 CMake,以便可以包含来自另一个使用 Qt 的库的头文件。编译时出现以下错误:

CMake Error at /usr/lib/cmake/Boost-1.77.0/BoostConfig.cmake:141 (find_package):
Could not find a package configuration file provided by "boost_filesystem"
(requested version 1.77.0) with any of the following names:
boost_filesystemConfig.cmake
boost_filesystem-config.cmake
Add the installation prefix of "boost_filesystem" to CMAKE_PREFIX_PATH or
set "boost_filesystem_DIR" to a directory containing one of the above
files.  If "boost_filesystem" provides a separate development package or
SDK, be sure it has been installed.
Call Stack (most recent call first):
/usr/lib/cmake/Boost-1.77.0/BoostConfig.cmake:258 (boost_find_component)
CMakeLists.txt:32 (find_package)
-- Configuring incomplete, errors occurred!

当我搜索 ubuntu 文件时,我在系统中的任何位置都找不到这个文件,因此我无法将其添加到我的 CMakeLists.txt 文件中。我也尝试过其他类似的解决方案,例如

sudo apt-get install libboost-all-dev
和其他变体,但他们都说它们已经安装在我的机器上。任何帮助将非常感激!

c++ boost cmake windows-subsystem-for-linux
1个回答
0
投票

尝试:

sudo apt install libboost-filesystem-dev
© www.soinside.com 2019 - 2024. All rights reserved.