Hello, You probably did not declare the 'hello' function in the main.c file. To do this, just write a header of the function beforevthe main function.
Regards, Vlad On Aug 31, 2012 4:48 PM, "Rudra Banerjee" <bnrj.ru...@yahoo.com> wrote: > I have two file: > > #THE MAIN### > #include <gtk/gtk.h> > > int main( int argc, > char *argv[] ) > { > GtkWidget *window; > GtkWidget *button; > > gtk_init (&argc, &argv); > window = gtk_window_new (GTK_WINDOW_TOPLEVEL); > gtk_container_set_border_width (GTK_CONTAINER (window), 10); > button = gtk_button_new_with_label ("Hello World"); > g_signal_connect (button, "clicked", > G_CALLBACK (hello), NULL); > gtk_container_add (GTK_CONTAINER (window), button); > gtk_widget_show (button); > gtk_widget_show (window); > gtk_main (); > > return 0; > } > > > #########hello.c > #include <gtk/gtk.h> > static void hello( GtkWidget *widget, > gpointer data ) > { > g_print ("Hello World\n"); > } > > > If they are in separate file, then, > $ gcc `pkg-config --cflags --libs gtk+-3.0` hello.c main.c -c > main.c: In function ‘main’: > main.c:13:5: error: ‘hello’ undeclared (first use in this function) > main.c:13:5: note: each undeclared identifier is reported only once for > each function it appears in > > But obviously, putting both of them together in a single file works. > How to compile while keeping them seperate > ? > > > _______________________________________________ > gtk-app-devel-list mailing list > gtk-app-devel-list@gnome.org > https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list _______________________________________________ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list