Re: [gtk-list] (libraries) Installing gtk, help please



Arturo Tena wrote:

> Hello !!
>
> I have accessed
> http://www.redhat.com/linux-info/gtk/gtk-list/
> to search for the answer, but the search link is broken =(
>
> Although I considering me such as a beginner in the Linux world, may be
> you wish to help me, please.
>
> I've just downloaded gtk...
> 1) I run configure...... all OK
> 2) I run make........... all OK
> 3) I run make install... all OK expect for the next message appeared
> some times:
>
> ...
> chmod 644 /usr/local/lib/libgdk.a
> PATH="/usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin:/usr/bin/mh:/home/arturo/bin:/sbin"
> ldconfig -n /usr/local/lib
> ------------------------------------------------------------------------------
> Libraries have been installed in:
>    /usr/local/lib
>
> To link against installed libraries in a given directory, LIBDIR,
> you must use the `-LLIBDIR' flag during linking.
>
>  You will also need to do one of the following:
>    - add LIBDIR to the `LD_LIBRARY_PATH' environment variable
>      during execution
>    - add LIBDIR to the `LD_RUN_PATH' environment variable
>      during linking
>    - use the `-Wl,--rpath -Wl,LIBDIR' linker flag
>    - have your system administrator add LIBDIR to `/etc/ld.so.conf'
>
> See any operating system documentation about shared libraries for
> more information, such as the ld(1) and ld.so(8) manual pages.
> ------------------------------------------------------------------------------
> /bin/sh ../mkinstalldirs /usr/local/bin
> /bin/sh ../mkinstalldirs /usr/local/include/gdk
> ...
> ...
>
> OK, let's add /usr/local/lib to /etc/ld.so.conf
>
> 4) Tried to compile hello.c example (from Info pages):
>
> [arturo@localhost gtk]$ cat /etc/ld.so.conf
> /usr/i486-linuxaout/lib
> /usr/X11R6/lib
> /usr/i486-linux-libc5/lib
> /usr/local/lib
> [arturo@localhost gtk]$ su
> Password:
> [root@localhost gtk]# /sbin/ldconfig
> [root@localhost gtk]# exit
> [arturo@localhost gtk]$ gcc hello.c -o hello
> /tmp/cca280621.o: In function `main':
> /tmp/cca280621.o(.text+0xf): undefined reference to `gtk_init'
> /tmp/cca280621.o(.text+0x19): undefined reference to `gtk_window_new'
> /tmp/cca280621.o(.text+0x28): undefined reference to
> `gtk_container_get_type'
> /tmp/cca280621.o(.text+0x34): undefined reference to
> `gtk_object_check_cast'
> /tmp/cca280621.o(.text+0x3f): undefined reference to
> `gtk_container_border_width'
> /tmp/cca280621.o(.text+0x4c): undefined reference to `gtk_label_new'
> /tmp/cca280621.o(.text+0x5d): undefined reference to
> `gtk_container_get_type'
> /tmp/cca280621.o(.text+0x69): undefined reference to
> `gtk_object_check_cast'
> /tmp/cca280621.o(.text+0x74): undefined reference to `gtk_container_add'
> /tmp/cca280621.o(.text+0x80): undefined reference to `gtk_widget_show'
> /tmp/cca280621.o(.text+0x8c): undefined reference to `gtk_widget_show'
> /tmp/cca280621.o(.text+0x94): undefined reference to `gtk_main'
> [arturo@localhost gtk]$
>

You need to link against the gtk library.

> What's missing?
>
> NOTE: I know gcc can't find gtk lib, why? If I run:
>

The following are the correct ways to compile.  By default, gcc links only against the
libc(am I correct?), and you would need to add the other libraries you want to link
agains like -lgtk for example.

> [arturo@localhost gtk]$ gcc hello.c -o hello -L/usr/local/lib
> -L/usr/X11R6/lib -lgtk -lgdk -lglib -lXext -lX11 -lm
>
> or
>
> [arturo@localhost gtk]$ gcc hello.c -o hello -L/usr/X11R6/lib -lgtk
> -lgdk -lglib -lXext -lX11 -lm
>
> 'hello' runs pretty well, but if i run:
>
> [arturo@localhost gtk]$ gcc hello.c -o hello -L/usr/X11R6/lib -lgdk
> -lglib -lXext -lX11 -lm
>
> the error message:
>
> /tmp/cca280621.o: In function `main':
> /tmp/cca280621.o(.text+0xf): undefined reference to `gtk_init'
> /tmp/cca280621.o(.text+0x19): undefined reference to `gtk_window_new'
> /tmp/cca280621.o(.text+0x28): undefined reference to
> `gtk_container_get_type'
> and so on...
>
> appears again.
>
> Please, help me...
>
> THANK YOU IN ADVANCE for your time and your answer !! =) =)
>
> --
> To unsubscribe: mail -s unsubscribe gtk-list-request@redhat.com < /dev/null






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