如何修复 CMake error Could not find a package configuration file provided by boost_filesystem
问题:
编译基于 CMake 的 C++ 时
boost_filesystem_cmake.txt
CMake Error at /usr/lib/x86_64-linux-gnu/cmake/Boost-1.71.0/BoostConfig.cmake:117 (find_package):
Could not find a package configuration file provided by "boost_filesystem"
(requested version 1.71.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/x86_64-linux-gnu/cmake/Boost-1.71.0/BoostConfig.cmake:182 (boost_find_component)
/usr/share/cmake-3.16/Modules/FindBoost.cmake:443 (find_package)
CMakeLists.txt:58 (find_package)解决方案
错误消息试图告诉你你没有安装 boost filesystem 库(或 CMake 找不到它)。
例如在 Ubuntu 上,使用以下命令安装
install_boost_filesystem.sh
sudo apt -y install libboost-filesystem-dev在 Windows 上你可以使用 Windows 预构建 boost 二进制文件安装它。
If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow