如何将jsoncpp库包含到unix上的项目中?

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

我要包括的库是jsoncpp。我对此有严重的麻烦。我为此库使用了home-brew安装,即brew install jsoncppbrew 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是...的统一版本...

c++ cmake homebrew static-libraries jsoncpp
1个回答
0
投票

您可以在CMake中使用FetchContent功能。可通过GitHub上的git仓库获得Jsoncpp

© www.soinside.com 2019 - 2024. All rights reserved.