Re: New to GTK, need help

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

 



GTK_OBJECT and GTK_SIGNAL_FUNC are obsolete, use G_OBJECT and G_CALLBACK
instead.

Regards,
Jean

Le vendredi 20 janvier 2012 à 22:50 +0700, Siravich Khongrod a écrit :
> Not sure if I am in the right section, but I am new to the GTK+ and I
> have got the following problems
> 
> 
> [folk@ASUS GUI]
> $ gcc `pkg-config --cflags --libs gtk+-3.0` PlainWin.c
> PlainWin.c: In function ‘main’:
> PlainWin.c:19:2: warning: passing argument 1 of
> ‘g_signal_connect_data’ makes pointer from integer without a cast
> [enabled by default]
> /usr/include/glib-2.0/gobject/gsignal.h:353:9: note: expected
> ‘gpointer’ but argument is of type ‘int’
> PlainWin.c:19:2: warning: passing argument 3 of
> ‘g_signal_connect_data’ makes pointer from integer without a cast
> [enabled by default]
> /usr/include/glib-2.0/gobject/gsignal.h:353:9: note: expected
> ‘GCallback’ but argument is of type ‘int’
> /tmp/ccwGupob.o: In function `main':
> PlainWin.c:(.text+0x9c): undefined reference to `GTK_SIGNAL_FUNC'
> PlainWin.c:(.text+0xaa): undefined reference to `GTK_OBJECT'
> 
> 
> Here is the program:
> 
> 
> #include <gtk/gtk.h>
> #include <stdio.h>
> 
> 
> static int count = 0;
> void button_clicked (GtkWidget *button, gpointer data)
> {
> printf("%s pressed %d time(s) \n", (char *) data, ++count);
> }
> 
> 
> int main (int argc, char *argv[])
> {
> GtkWidget *window;
> GtkWidget *button;
> gtk_init(&argc, &argv);
> window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
> button = gtk_button_new_with_label("Hello World!");
> gtk_container_add(GTK_CONTAINER(window), button);
> g_signal_connect(GTK_OBJECT (button),
> "clicked",GTK_SIGNAL_FUNC(button_clicked),"Button 1");
> gtk_widget_show(button);
> gtk_widget_show(window);
> gtk_main ();
> return 0;
> }
> 
> 
> Sorry for my english
> Thank you
> 
> 
> Siravich
> _______________________________________________
> gtk-list mailing list
> gtk-list@xxxxxxxxx
> http://mail.gnome.org/mailman/listinfo/gtk-list


_______________________________________________
gtk-list mailing list
gtk-list@xxxxxxxxx
http://mail.gnome.org/mailman/listinfo/gtk-list



[Index of Archives]     [Touch Screen Library]     [GIMP Users]     [Gnome]     [KDE]     [Yosemite News]     [Steve's Art]

  Powered by Linux