Today I was writing some simple glib application and had a look at
this page [1], to get some advice on how to compile and link my
program with glib. However for me the advice was not entirely
correct, since it give this example line:I adjusted it a bit to my file names and added c99 support:cc `pkg-config --cflags --libs glib-2.0` hello.c -o hello gcc `pkg-config --cflags glib-2.0` `pkg-config --libs glib-2.0` main.c -o main --std=c99 But it turns out this is wrong, and the correct way is: gcc main.c `pkg-config --cflags glib-2.0` `pkg-config --libs glib-2.0` -o main --std=c99 The only difference is that the file name is in the front instead of the end. When I tried the first version, it would compile but give link errors such as: main.c:(.text+0x1e1): undefined reference to `g_list_append'. Once I put the file name at the beginning it worked well. I suggest to correct this, and also add a note telling the developer that he needs to put the name of the file at the beginning. If someone points me to the source of this documentation, I can also write a patch. Regards Lanoxx [1] http://developer.gnome.org/glib/2.32/glib-compiling.html |