Re: Simple glib compilation problem: DSO missing from command line



Il Fri, 27 Mar 2015 11:31:59 +0100 Bruno Cauet <brunocauet gmail com> scrisse:

Hi,
I'm having trouble compiling stuff with glib. Here it is:
$ LANG=C gcc -I /usr/include/glib-2.0  -I /usr/lib/glib-2.0/include -L
/usr/lib -l gio-2.0 segfault.c
/usr/bin/ld: /usr/lib/libgio-2.0.so: undefined reference to symbol
'g_object_unref'
/usr/lib/libgobject-2.0.so.0: error adding symbols: DSO missing from
command line
collect2: error: ld returned 1 exit status

Hi,

you are missing a couple of libraries from the command-line and the
order is wrong. To be on the safe side just use pkg-config:

$ LANG=C gcc $(pkg-config --cflags gio-2.0) segfault.c $(pkg-config --libs gio-2.0)

You will find gio.c attached. There's related problems with solution on the
internet but those solutions were related to the library inclusion order,
and I cannot adapt it to my case (single library in which the symbol is
also defined).

Nothing attached here.

Ciao.
-- 
Nicola


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