Re: complie error
- From: Allin Cottrell <cottrell wfu edu>
- To: yeajchao <yeajchao yahoo com cn>
- Cc: gtk-app <gtk-app-devel-list gnome org>, gtk-list <gtk-list gnome org>
- Subject: Re: complie error
- Date: Thu, 17 Nov 2005 00:31:25 -0500 (EST)
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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]