ubuntu - 如何从 CMake 访问 Beast on Boost 1.66 和 1.67
问题描述
我正在尝试使用 Beast 制作一个 CMake 项目,并且它已从源代码正确安装/usr/local/include/boost
,但我无法让 CMake 找到它。我虽然它可能是一个3.10.2
,所以我累了3.11.4
,3.12.0-rc1
但都没有工作。有谁知道该怎么做?
环境:Windows CLion 2018.1.5 和 WSL 上的 Ubuntu 18.04LTS。
尝试运行 CMake 时,出现以下错误:
CMake Warning at /home/aidan/Apps/cmake-3.11.4-Linux-x86_64/share/cmake-3.11/Modules/FindBoost.cmake:1723 (message):
No header defined for beast; skipping header check
Call Stack (most recent call first):
CMakeLists.txt:15 (find_package)
CMake Error at /home/aidan/Apps/cmake-3.11.4-Linux-x86_64/share/cmake-3.11/Modules/FindBoost.cmake:2044 (message):
Unable to find the requested Boost libraries.
Boost version: 1.67.0
Boost include path: /usr/local/include
Could not find the following Boost libraries:
boost_beast
Some (but not all) of the required Boost libraries were found. You may
need to install these additional Boost libraries. Alternatively, set
BOOST_LIBRARYDIR to the directory containing Boost libraries or BOOST_ROOT
to the location of Boost.
Call Stack (most recent call first):
CMakeLists.txt:15 (find_package)
解决方案
Boost beast
是一个只有头文件的库。find_package(Boost COMPONENTS ...)
在调用中不得引用仅标头库。所以beast
从find_package(Boost COMPONENTS ... REQUIRED)
通话中删除。
要了解 Boost 库是否只是标头,请查看以下Boost 页面。
推荐阅读
- java - 仅当负前瞻和负后瞻都被统计时才拆分字符串
- npm - 在 Windows 上安装 BuckleScript 时遇到问题
- oracle - 如何在Oracle apex中将信息存储在数据库中以获取具有单个值的复选框和具有多个值的复选框
- serialization - 简单序列化 ODataQueryOptions
- bokeh - 如何从 js 回调中获取旧值和新值?
- android - 我在firebase上做循环和新的我没有从firebase/firestore接收数据尝试从我的keyValue获取数据
- sql - Access SQL - 是否可以按开关值分组?
- r - 在 kable 之后在 markdown 中重新设置粗体标题
- json - 运行 npm install 命令时 JSON 输入错误意外结束。此问题有什么解决办法吗?
- android - Android:在哪里安排工作?