Re: Problem Linking with GTK 1.2.9 and 1.2.10
- From: WAN Hing Wah <50191914 ee cityu edu hk>
- To: Edward Nicholas <jn8852 bristol ac uk>
- Cc: gtk-app-devel-list gnome org
- Subject: Re: Problem Linking with GTK 1.2.9 and 1.2.10
- Date: Tue, 9 Apr 2002 23:00:22 +0800 (HKT)
the gtk+ tutorial is updated for gtk+ 2.0
G_OBJECT and G_CALLBACK are macros in glib 2.0 and g_signal_connect is
function in glib 2.0 ,so you should use gtk+ 2.0 instead
or use gtk_signal_connect instead
On Tue, 9 Apr 2002, Edward Nicholas wrote:
Hi I am new to programming with GTK. I am having a problem linking the
example helloworld program (the one in the tutorial). I have tried on
solaris and linux with GTK versions 1.2.9 and 1.2.10 respectively. The
program compiles ok using:
gcc `gtk-config --cflags` -c helloworld.c
How ever when it comes to linking I get the following error message:
gcc -o helloworld helloworld.o -L/usr/openwin/lib/ -ldga `gtk-config
--libs`
helloworld.o: In function `main':
helloworld.o(.text+0xa4): undefined reference to `G_OBJECT'
helloworld.o(.text+0xb8): undefined reference to `G_CALLBACK'
helloworld.o(.text+0xd4): undefined reference to `g_signal_connect'
helloworld.o(.text+0xe0): undefined reference to `G_OBJECT'
helloworld.o(.text+0xf4): undefined reference to `G_CALLBACK'
helloworld.o(.text+0x110): undefined reference to `g_signal_connect'
helloworld.o(.text+0x15c): undefined reference to `G_OBJECT'
helloworld.o(.text+0x170): undefined reference to `G_CALLBACK'
helloworld.o(.text+0x18c): undefined reference to `g_signal_connect'
helloworld.o(.text+0x198): undefined reference to `G_OBJECT'
helloworld.o(.text+0x1ac): undefined reference to `G_CALLBACK'
helloworld.o(.text+0x1c8): undefined reference to
`g_signal_connect_swapped'
collect2: ld returned 1 exit status
gmake: *** [all] Error 1
It appears to me that the glib libraries are not being linked correctly
(I believe that the undefined references starting with G_ or g_ refer to
glib?).
I have examined the output of gtk-config and I get the following which
this appears to include the correct libraries. (Although on solaris I
have to link against -ldga as well - see above).
% gtk-config --libs
-L/opt/gnome-1.4/lib -lgtk -lgdk -lgmodule -lglib -ldl -lXext -lX11
-lsocket -lnsl -lm
Thanks
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]