Re: [gtk-list] about Helloworld:GTKtutor's example.



On Sun, 21 Feb 1999, Masan wrote:

> I'm new to linux,I'm just learning GTKtutor.I met a problem when I compile helloworld.c,
> an example of GTKtutor.
> 
> When I type 'make' ,It told me like this:
> "/tmp/cca003751.o:infunction `main':
> /tmp/cca003751.o(.text+0xd1):undefined reference to `gtk_container_set_border_width'"
> 
> Why?
> My linux(Red Hat 5.1) was just installed! and I have done nothing except this.

Hi, 
it sounds very strange to me -- compiler can't find only one function 
prototype/or function itself, with others everithing is well, yes?

So, first try to comment  line with gtk_container_set_border_width, this
function just set padding between window border and widget which is
inclosed into it.

To locate, what is te problem (is it with .h file -- therer is no
function prototype in gtk headers, or there is no this function in your,
very strange gtk+) you need to change your Makefile:

helloworld.o: helloworld.c
        gcc `gtk-config --cflags`  -Wall -c helloworld.c
# this should make .o file

helloworld: helloworld.o
        gcc helloworld.c -o helloworld  `gtk-config --libs`         
# this -- executable

if error will occured on stage making helloworld.o -- tere is no prototype
of  gtk_container_set_border_width in gtkcontainer.h.
If you have your GTK from rpm pack (this way you have a very old version ~
1.0.0) have a look at /usr/include/gtk/gtkcontainer.h, from tar-file -- in
/usr/local/include/gtk/.

else:) if error will happen on second stage, building executable -- this
means you gtk have not gtk_container_set_border_width at all, and this is
very very strange.

Anyway, the best thing you can do is:
* rpm -e <your gtk rpm's>
* download latest glib+-1.1.16, gtk+-1.1.16
* compile and install them.
!!! your gimp, if you have it installed, wont work after it, you'll need  
to have newer or compile it yourself

This way you'll have all examples in <your gtk sourcees>/examples/ and
other very good source of information about gkt --
<your gtk sourcees>/gtk/testgtk.c

Good Luck,

_____
Alexander Kotelnikov
Saint-Petersburg, Russia
mailto:sacha@ak2614.spb.edu





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