Re: Compiling glib applications



On 08/09/2012 02:46 PM, Lanoxx wrote:
> 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.

That's odd. I haven't experienced this at all, even when doing compiling
and linking in one step.

I'm sure someone more knowledgeable than me will pipe in.

> 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.

It lives here:

http://git.gnome.org/browse/glib/tree/docs/reference/glib/compiling.xml

May I also suggest gtk-devel-list gnome org for stuff related to
developing glib? Yeah, it's not super obvious list to choose at first
glance :)

Cheers,

Stef



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]