Last updated on May 31, 2020 by Dan Nanni
'Make' error - glib.h no such file or directory.How can I fix this error?
glib.h
is part of libglib2.0-dev
package. So in Ubuntu or Debian-based environment, make sure to install this package.
$ sudo apt-get install libglib2.0-dev
If that does not solve the problem, it may be because the application you are building expects glib
development files in a different directory. In that case, you will need to manually specify information about glib-2.0
library in your Makefile. To find out what information to add to Makefile, you can use pkg-config
command, which automatically finds metadata about installed libraries.
Run the following command, and put the output of the command in your Makefile.
$ pkg-config --cflags --libs glib-2.0
-I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -lglib-2.0
In this example, the command returns the above string. So in this case, I will specify "-I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include
" and "-lglib-2.0
" somewhere in my Makefile.
This website is made possible by minimal ads and your gracious donation via PayPal or credit card
Please note that this article is published by Xmodulo.com under a Creative Commons Attribution-ShareAlike 3.0 Unported License. If you would like to use the whole or any part of this article, you need to cite this web page at Xmodulo.com as the original source.
Xmodulo © 2021 ‒ About ‒ Write for Us ‒ Feed ‒ Powered by DigitalOcean