I can't compile that code under ubuntu 11.10 while it compiles normally under ubuntu 10.04:
#include <stdio.h>
#include <glib.h>
int main(int argc, char** argv) {
GList* list = NULL;
list = g_list_append(list, "Hello world!");
printf("The first item is '%s'\n", g_list_first(list)->data);
return 0;
}
$ gcc $(pkg-config --cflags --libs glib-2.0) hello_glib.c
hello_glib.c:(.text+0x24): undefined reference to g_list_append
hello_glib.c:(.text+0x34): undefined reference to g_list_first
collect2: ld returned 1 exit status
I have the libglib2.0-dev installed, why the error then ?