当前时区为 UTC + 8 小时



发表新帖 回复这个主题  [ 6 篇帖子 ] 
作者 内容
1 楼 
 文章标题 : 请问谁用过GTK+作过开发
帖子发表于 : 2006-12-29 13:54 

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


页首
 用户资料  
 
2 楼 
 文章标题 : trying to search the declare of G_TYPE_CHECK_INSTANCE_CAST
帖子发表于 : 2006-12-29 14:38 

注册: 2006-12-27 23:54
帖子: 19
送出感谢: 0 次
接收感谢: 0 次
But failed, where is its declare or definition? or it's a glib function?


页首
 用户资料  
 
3 楼 
 文章标题 :
帖子发表于 : 2006-12-29 14:50 
头像

注册: 2005-08-14 21:55
帖子: 58428
地址: 长沙
送出感谢: 4
接收感谢: 272
GtkWidget *W;
不知道是不是属于obj的。以前试过小程序,好像有好多专门转结构和类的内部函数,老需要转来转去。后来就没试过了。


_________________
● 鸣学


页首
 用户资料  
 
4 楼 
 文章标题 :
帖子发表于 : 2006-12-29 14:58 

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


页首
 用户资料  
 
5 楼 
 文章标题 : Re: 请问谁用过GTK+作过开发
帖子发表于 : 2007-01-14 11:07 
头像

注册: 2006-07-14 18:56
帖子: 345
地址: Apple Valley, Planet Tux, Linux System
送出感谢: 0 次
接收感谢: 0 次
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.


页首
 用户资料  
 
6 楼 
 文章标题 :
帖子发表于 : 2007-03-08 14:53 

注册: 2006-05-17 11:41
帖子: 3
送出感谢: 0 次
接收感谢: 0 次
请把Makefile贴上来看看。
一般来说GTK2里不再提倡使用GtkText了


页首
 用户资料  
 
显示帖子 :  排序  
发表新帖 回复这个主题  [ 6 篇帖子 ] 

当前时区为 UTC + 8 小时


在线用户

正在浏览此版面的用户:没有注册用户 和 2 位游客


不能 在这个版面发表主题
不能 在这个版面回复主题
不能 在这个版面编辑帖子
不能 在这个版面删除帖子
不能 在这个版面提交附件

前往 :  
本站点为公益性站点,用于推广开源自由软件,由 DiaHosting VPSBudgetVM VPS 提供服务。
我们认为:软件应可免费取得,软件工具在各种语言环境下皆可使用,且不会有任何功能上的差异;
人们应有定制和修改软件的自由,且方式不受限制,只要他们自认为合适。

Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
简体中文语系由 王笑宇 翻译