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 or CentOS/RHEL 7 or higher:

$ sudo yum install jsoncpp-devel

On CentOS/RHEL 6 or lower, 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
$ 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
Download this article as ad-free PDF (made possible by your kind donation): 
Download PDF

Subscribe to Ask Xmodulo

Do you want to receive Linux related questions & answers published at Ask Xmodulo? Enter your email address below, and we will deliver our Linux Q&A straight to your email box, for free. Delivery powered by Google Feedburner.

Support Xmodulo

Did you find this tutorial helpful? Then please be generous and support Xmodulo!

Leave a comment

Your email address will not be published. Required fields are marked *