mirror of
https://github.com/LCTT/TranslateProject.git
synced 2025-01-04 22:00:34 +08:00
1.6 KiB
1.6 KiB
Linux FAQs with Answers--How to fix “fatal error: jsoncpp/json/json.h: No such file or directory”
Question: I am trying compile a C++ application, but I am getting the following error:
"fatal error: jsoncpp/json/json.h: No such file or directory"
How can I fix this problem?
The error indicates that you are missing JsonCpp development files (i.e., JsonCpp library and header files). JsonCpp is a C++ library for JSON-formatted data manipulation. Here is how to install JsonCpp development files on various Linux distros.
On Debian, Ubuntu or Linux Mint:
$ sudo apt-get install libjsoncpp-dev
On Fedora:
$ sudo yum install jsoncpp-devel
On CentOS, JsonCpp is not available as a pre-built package. So you can build and install JsonCpp from the source as follows.
$ sudo yum install cmake
$ git clone https://github.com/open-source-parsers/jsoncpp.git
$ cd jsoncpp
$ mkdir -p build/debug
$ cd build/debug
$ cmake -DCMAKE_BUILD_TYPE=debug -DJSONCPP_LIB_BUILD_SHARED=OFF -G "Unix Makefiles" ../../
$ make
$ sudo make install