Search code examples
jsonubuntuglibapt

How to solve a problem of including json-glib.h in a c++ file


I'm trying to compile a c++ file that requires the header json-glib.h and the compilation log says that such header is not found. I'm in ubuntu 18.04 LTS.

I've tried executing dpkg -l '*json-glib*' to check that i have such file in my system and the result is:

||/ Nombre                                       Versión                     Arquitectura                

ii  libjson-glib-1.0-0:amd64                     1.4.2-3                     amd64                     
ii  libjson-glib-1.0-common                      1.4.2-3                     all                       

So next, i executed the command pkg-config --cflags libjson-glib-1.0 and got:

Package libjson-glib-1.0 was not found in the pkg-config search path.
Perhaps you should add the directory containing `libjson-glib-1.0.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libjson-glib-1.0' found

I tried pkg-config --cflags json-glib-1.0 , pkg-config --cflags json-glib, and pkg-config --cflags libjson-glib as well and the result is similar as above.

I also followed the instructions of the answers of Fatal error: json-glib.h file not found and https://unix.stackexchange.com/questions/297277/make-doesnt-find-an-installed-library/298035#298035 and still i have the problem.

My include in the code is:

 #include <json-glib/json-glib.h>
...

I will appreciate any help you can give me, Thanks.


Solution

  • Try to install the package libjson-glib-dev, after that run pkg-config --cflags json-glib-1.0