I am using glib.h as well-
Do this to compile all your glib.h programs :)
gcc `pkg-config --cflags --libs glib-2.0` filename.c
Make sure to surround pkg-config --cflags --libs glib-2.0
with back-quotes
which you find under tilde (left most key on the querty keyboard).
Thank me later .. :P