我要包括的库是jsoncpp。我对此有严重的麻烦。我为此库使用了home-brew安装,即brew install jsoncpp
(brew install
是Linux sudo-apt get
的unix版本)。通常homebrew
会将内容安装到我的路径中,因此我可以使用它。我要离开这里的example。
#include <json/json.h>
返回错误10: fatal error: 'json/value.h' file not found
。
我正在使用cmake,因为CLion会自动设置它。现在这是非常基本的:
#CMakeLists.txt cmake_minimum_required(VERSION 3.13) project(Read_JSON) set(CMAKE_CXX_STANDARD 17) add_executable(Read_JSON main.cpp)
但是,由于某种原因找不到
jsoncpp
。如何在我的项目中包含此库?
我要包括的库是jsoncpp。我对此有严重的麻烦。我为该库使用了自制程序安装,即brew install jsoncpp(brew install是...的统一版本...
您可以在CMake中使用FetchContent功能。可通过GitHub上的git仓库获得Jsoncpp