Fix “glibconfig.h: No such file or directory” error

I installed glib-devel on Void Linux, and wrote a simple program for test. But the compilation reported following error:

# gcc -I/usr/include/glib-2.0 main.c -lglib-2.0
......
/usr/include/glib-2.0/glib/gtypes.h:32:10: fatal error: glibconfig.h: No such file or directory
   32 | #include <glibconfig.h>
      |          ^~~~~~~~~~~~~~
compilation terminated.

glibconfig.h is in /usr/lib/glib-2.0/include directory, so it should be added into header file search path:

# gcc -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include main.c -lglib-2.0
#

2 thoughts on “Fix “glibconfig.h: No such file or directory” error”

  1. glibconfig.h is not in /usr/lib/glib-2.0/include directory on void
    it is in /usr/lib64/glib-2.0/include

    1. # ll /usr/lib/glib-2.0/include/glibconfig.h
      -rw-r--r-- 1 root root 5637 Mar 4 02:31 /usr/lib/glib-2.0/include/glibconfig.h
      # ll /usr/lib64/glib-2.0/include/glibconfig.h
      -rw-r--r-- 1 root root 5637 Mar 4 02:31 /usr/lib64/glib-2.0/include/glibconfig.h

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.