Electronics & Programming

develissimo

Open Source electronics development and programming

  • You are not logged in.

#1 Nov. 17, 2005 05:08:34

y.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

complie error


Hello all
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
/*-----------------------------------------------*/

I do not know what's wrrong in my program
when i delete the g_thread_init function from my
program,
it will complie succesfully
but when i run the object file
it failed
Can anybody help me?
Thanks in advance!


__________________________________________________
赶快注册雅虎超大容量免费邮箱?http://cn.mail.yahoo.com_______________________________________________
gtk-list mailing list
gtk-list@gnome.orghttp://mail.gnome.org/mailman/listinfo/gtk-list

Offline

#2 Nov. 17, 2005 13:49:01

Allin C.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

complie error


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 mailing list
gtk-list@gnome.orghttp://mail.gnome.org/mailman/listinfo/gtk-list

Offline

Board footer

Moderator control

Enjoy the 18th of November
PoweredBy

The Forums are managed by develissimo stuff members, if you find any issues or misplaced content please help us to fix it. Thank you! Tell us via Contact Options
Leave a Message
Welcome to Develissimo Live Support