请问谁用过GTK+作过开发

编译安装或者制作Deb包
回复
christina
帖子: 19
注册时间: 2006-12-27 23:54
送出感谢: 0
接收感谢: 0

请问谁用过GTK+作过开发

#1

帖子 christina » 2006-12-29 13:54

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))
christina
帖子: 19
注册时间: 2006-12-27 23:54
送出感谢: 0
接收感谢: 0

trying to search the declare of G_TYPE_CHECK_INSTANCE_CAST

#2

帖子 christina » 2006-12-29 14:38

But failed, where is its declare or definition? or it's a glib function?
头像
eexpress
帖子: 58428
注册时间: 2005-08-14 21:55
来自: 长沙
送出感谢: 4 次
接收感谢: 256 次

#3

帖子 eexpress » 2006-12-29 14:50

GtkWidget *W;
不知道是不是属于obj的。以前试过小程序,好像有好多专门转结构和类的内部函数,老需要转来转去。后来就没试过了。
● 鸣学
christina
帖子: 19
注册时间: 2006-12-27 23:54
送出感谢: 0
接收感谢: 0

#4

帖子 christina » 2006-12-29 14:58

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.
头像
5451vs5451
帖子: 345
注册时间: 2006-07-14 18:56
来自: Apple Valley, Planet Tux, Linux System
送出感谢: 0
接收感谢: 0

Re: 请问谁用过GTK+作过开发

#5

帖子 5451vs5451 » 2007-01-14 11:07

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))


It seems that some library is missing, or you just forgot to tell the compiler where it is.
hephaestus
帖子: 3
注册时间: 2006-05-17 11:41
送出感谢: 0
接收感谢: 0

#6

帖子 hephaestus » 2007-03-08 14:53

请把Makefile贴上来看看。
一般来说GTK2里不再提倡使用GtkText了
回复

回到 “编译或打包”