New to GTK, need help



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


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