毕业论文开发语言企业开发JAVA技术.NET技术WEB开发Linux/Unix数据库技术Windows平台移动平台嵌入式论文范文英语论文
您现在的位置: 毕业论文 >> linux >> 正文

undefined reference to `gtk_menu_item_set_use_underline'错误

更新时间:2012-8-15:  来源:毕业论文

用函数gtk_menu_item_set_use_underline设置快捷键时,使用Alt+下划线之后的字母实现。
当我在Visual Studio 2005中将代码写好,拷贝到Linux下,进行make时,出现了:
undefined reference to `gtk_menu_item_set_use_underline'错误,
前提:源程序在VS2005下编译成功,而且运行良好。
看到了这样一段话:

 

gtk_menu_item_get_use_underline ()

gboolean gtk_menu_item_get_use_underline (GtkMenuItem *menu_item);
Checks if an underline in the text indicates the next character should be used for the mnemonic accelerator key. 
menu_item : a GtkMenuItem  

Returns : TRUE if an embedded underline in the label indicates the mnemonic accelerator key. 

Since 2.16我的是Fedora10,昨天刚采用在线安装的方法安装成功。
是不是这个和我的gtk+版本有关系?怎么查看我现在使用的gtk+的版本?如果是版本的问题,那么在VS2005下也应该报错才对,这个什么原因?怎么解决?
注释掉那行代码后,就可以make成功,也可以运行出结果。menuItem = gtk_menu_item_new_with_label ("_File");
gtk_menu_item_set_use_underline (GTK_MENU_ITEM(menuItem), TRUE);
就是第二行的错。 

注释到报错的那行代码后,编译就可以了。为什么gtk_menu_item_get_use_underline ()会报错呢?
 
undefined reference to `gtk_menu_item_set_use_underline'错误,
一般来说是链接是没找到对应的库
看看你的编译选项,是不是指定了所有的库。
如果用的是pkgconfig应该不会出错,那么就剩下版本问题了。
查看gtk版本
pkg-config --modversion gtk+-2.0 

如果没有pkgconfig,那就去gtk的lib目录看看后缀名就知道了 
今天在看gtk+API手册的时候发现了一个函数:gtk_menu_item_new_with_mnemonic ()
GtkWidget* gtk_menu_item_new_with_mnemonic (const gchar *label);
Creates a new GtkMenuItem containing a label. The label will be created using gtk_label_new_with_mnemonic(), so underscores in label indicate the mnemonic for the menu item.


label : The text of the button, with an underscore in front of the mnemonic character  
Returns : a new GtkMenuItem  
这个函数解决了那个问题。

设为首页 | 联系站长 | 友情链接 | 网站地图 |

copyright©youerw.com 优尔论文网 严禁转载
如果本毕业论文网损害了您的利益或者侵犯了您的权利,请及时联系,我们一定会及时改正。