When I compile an open sourece project, which bases on GTK+, one file containing the following code can't get linked:
void log_txt(gchar *to_write){
GtkWidget *W;
W = lookup_widget (GTK_WIDGET (w_main), "log_zone");
gtk_text_insert (GTK_TEXT (W), NULL, NULL,NULL, to_write,-1);
}
Always this error report:
callbacks.o: In function `log_txt':/home/user/Desktop/openha-0.3.6/src/callbacks.c:277: undefined reference to `GTK_TEXT'
collect2: ld returned 1 exit status
At first I think the head file is not included, but after checking, I find that the head file has already been included, now I doubted that the type of variable"W" is not acceptable here, but I can't find out the object inheritance hierarchy of GtkWidget, does anyone here has the coding experience of GTK+?
Here is the declare of GTK_TEXT:
#define GTK_TEXT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_TEXT, GtkText))
请问谁用过GTK+作过开发
-
- 帖子: 19
- 注册时间: 2006-12-27 23:54
-
- 帖子: 19
- 注册时间: 2006-12-27 23:54
trying to search the declare of G_TYPE_CHECK_INSTANCE_CAST
But failed, where is its declare or definition? or it's a glib function?
- eexpress
- 帖子: 58428
- 注册时间: 2005-08-14 21:55
- 来自: 长沙
-
- 帖子: 19
- 注册时间: 2006-12-27 23:54
Yes it's a Glib function, just now I find its declaration in gtype.h:
#define G_TYPE_CHECK_INSTANCE_CAST(instance, g_type, c_type) (_G_TYPE_CIC ((instance), (g_type), c_type))
Now, I'd like to do more research.
Hey guys, it's so strange that when you write down your problem and think about it dearly, then maybe you can get a clue, this is what I've done here.
#define G_TYPE_CHECK_INSTANCE_CAST(instance, g_type, c_type) (_G_TYPE_CIC ((instance), (g_type), c_type))
Now, I'd like to do more research.
Hey guys, it's so strange that when you write down your problem and think about it dearly, then maybe you can get a clue, this is what I've done here.
- 5451vs5451
- 帖子: 345
- 注册时间: 2006-07-14 18:56
- 来自: Apple Valley, Planet Tux, Linux System
Re: 请问谁用过GTK+作过开发
It seems that some library is missing, or you just forgot to tell the compiler where it is.christina 写了:When I compile an open sourece project, which bases on GTK+, one file containing the following code can't get linked:
void log_txt(gchar *to_write){
GtkWidget *W;
W = lookup_widget (GTK_WIDGET (w_main), "log_zone");
gtk_text_insert (GTK_TEXT (W), NULL, NULL,NULL, to_write,-1);
}
Always this error report:
callbacks.o: In function `log_txt':/home/user/Desktop/openha-0.3.6/src/callbacks.c:277: undefined reference to `GTK_TEXT'
collect2: ld returned 1 exit status
At first I think the head file is not included, but after checking, I find that the head file has already been included, now I doubted that the type of variable"W" is not acceptable here, but I can't find out the object inheritance hierarchy of GtkWidget, does anyone here has the coding experience of GTK+?
Here is the declare of GTK_TEXT:
#define GTK_TEXT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_TEXT, GtkText))
-
- 帖子: 3
- 注册时间: 2006-05-17 11:41