Why can’t I build a “hello world” for glib?

glib tends to hide itself… Your include statement doesn’t work because GCC doesn’t automatically search subdirectories, and so cannot see the glib.h in glib-1.2 or glib-2.0.

Read the Compiling GLib Applications page in the GLIB manuals… you use commands like pkg-config --cflags glib-2.0 to get the right flags for GCC.

The canonical way to do what you are trying is

% gcc test.c -Wall -o test `pkg-config --cflags --libs glib-2.0`

Note the back-ticks, which tell the shell to run the pkg-config command “in-place”.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)