On Thu, 17 Nov 2005, yeajchao wrote:
I encountered a simple problem while compile a simple program the program and the complie infomation as follow /**************************************************/ #include<gtk/gtk.h> int main (int argc, char **argv) { GtkWidget *window; /* init threads */ g_thread_init(NULL); gdk_threads_init(); /* init gtk */ gtk_init(&argc, &argv); window = gtk_window_new(GTK_WINDOW_TOPLEVEL); gtk_widget_show(window); gdk_threads_enter(); gtk_main(); gdk_threads_leave(); return 0; } /*************************************************/ and the complier told me that /*-----------------------------------------------*/ /tmp/cc1s1xqZ.o(.text+0x16): In function `main': : undefined reference to `g_thread_init' collect2: ld returned 1 exit status /*-----------------------------------------------*/
You need to link to the libraries needed by gthread: cc `pkg-config --cflags gtk+-2.0` myfile.c \ `pkg-config --libs gtk+-2.0` \ `pkg-config --libs gthread` Allin Cottrell _______________________________________________ gtk-list@xxxxxxxxx http://mail.gnome.org/mailman/listinfo/gtk-list