Re: Clock widget
- From: Jeroen Benckhuijsen <jfbenck home nl>
- To: gtk uk2 net
- Cc: gtk-list gnome org
- Subject: Re: Clock widget
- Date: 20 Sep 2000 21:12:29 -0100
> I'm trying to get the clock widget to work, to no avail. Here's the
> source file:
>
> #include <gtk/gtk.h>
> #include "gnome.h"
> #include "/usr/include/libgnomeui/gtk-clock.h"
>
> int main(int argc, char *argv[])
> {
> GtkWidget *window, *clk;
>
> gtk_init(&argc, &argv);
>
> window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
> clk = gtk_clock_new(GTK_CLOCK_REALTIME);
>
> gtk_signal_connect (GTK_OBJECT (window), "destroy",
> GTK_SIGNAL_FUNC (gtk_main_quit),
> "WM destroy");
>
> gtk_widget_show (window);
> gtk_main ();
>
> return(0);
> }
> /*********************************************************/
> Here's the Makefile:
>
> CC = gcc
>
> zzz: zzz.c
> $(CC) `gtk-config --cflags` zzz.c -o zzz `gtk-config --libs`
>
> clean:
> rm -f *.o zzz
>
> /*********************************************************/
>
> At compile time I get the following error messages:
>
> /tmp/ccN6oiYy.o: In function `main':
> /tmp/ccN6oiYy.o(.text+0x28): undefined reference to `gtk_clock_new'
> collect2: ld returned 1 exit status
>
> What's wrong if gtk-clock.h is precisely what defines gtk_clock
> functions?
> I'm using GTK+-1.2.5-2, linux 2.2.12 (RedHat 6.1), gnome 1.0.40.
>
> I would appreciate it if anybody could reply.
> Thanks,
>
> Henry
>
Rather easy:
Gtk-clock.h is in fact included (that's why the c-file is succesfully
compiled into a .o-file.) However when linking the the .o file to a
executable, the linker can't find the c code of gtk_clock_new. Add
"-L/usr/local/libgnomeui -lgnomeui" to you're makefile on the compile
line: $(CC) `gtk-config ...etc. The part after -L is the directory in
which the library with the code of gtk_clock_new can be found. The part
after -l is the filename of the library without the preceding lib and
without the .a at the end (libgnomeui.a --> gnomeui). After these
modifications the program should link fine. If libgnomeui is a shared
library you'll have to make this known to the dynamic linker (ld.so) by
adding an entry to /etc/ld.so.conf and running ldconfig, however this
requeires root-privileges
Jeroen
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]