当前位置: 技术问答>linux和unix
gtk+编译没有问题,运行的时候出问题,就是这句gtk_widget_show_all(window);请各位帮忙解答,谢谢
来源: 互联网 发布时间:2016-05-08
本文导语: 环境是xp下的cygwin 代码清单如下: #include void closeApp(GtkWidget *window,gpointer data) { gtk_main_quit(); } int main(int argc,char * argv[]) { GtkWidget *window; GtkWidget *label1,*label2,*label3; GtkWidget *hbox; GtkWidget *vbox; ...
环境是xp下的cygwin
代码清单如下:
报错如下:
如果把
换成
就不会有问题,请问怎么回事啊?谢谢阿~~
代码清单如下:
#include
void closeApp(GtkWidget *window,gpointer data)
{
gtk_main_quit();
}
int main(int argc,char * argv[])
{
GtkWidget *window;
GtkWidget *label1,*label2,*label3;
GtkWidget *hbox;
GtkWidget *vbox;
gtk_init(&argc,&argv);
window=gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_window_set_title(GTK_WINDOW(window),"The Window Title");
gtk_window_set_position(GTK_WINDOW(window),GTK_WIN_POS_CENTER);
gtk_window_set_default_size(GTK_WINDOW(window),300,200);
g_signal_connect(GTK_OBJECT(window),"destroy",GTK_SIGNAL_FUNC(closeApp),NULL);
label1=gtk_label_new("Label 1");
label2=gtk_label_new("Label 2");
label3=gtk_label_new("Label 3");
hbox=gtk_hbox_new(TRUE,5);
vbox=gtk_vbox_new(FALSE,10);
gtk_box_pack_start(GTK_BOX(vbox),label1,TRUE,FALSE,5);
gtk_box_pack_start(GTK_BOX(vbox),label2,TRUE,FALSE,5);
gtk_box_pack_start(GTK_BOX(hbox),vbox,TRUE,FALSE,5);
gtk_box_pack_start(GTK_BOX(hbox),label3,FALSE,FALSE,5);
gtk_container_add(GTK_CONTAINER(window),hbox);
gtk_widget_show_all(window);
gtk_main();
return 0;
}
报错如下:
(p16.4:1828): Pango-WARNING **: No builtin or dynamically loaded modules
were found. Pango will not work correctly. This probably means
there was an error in the creation of:
'/etc/pango/pango.modules'
You may be able to recreate this file by running pango-querymodules.
(p16.4:1828): GLib-GObject-CRITICAL **: g_object_ref: assertion `G_IS_OBJECT (object)' failed
(p16.4:1828): Pango-CRITICAL **: _pango_engine_shape_shape: assertion `PANGO_IS_FONT (font)' failed
Pango-ERROR **: file /instsoft/libxml/pango-1.8.1/pango/shape.c: line 75 (pango_shape): assertion failed: (glyphs->num_glyphs > 0)
aborting...
如果把
gtk_widget_show_all(window);
换成
gtk_widget_show_all(window);
就不会有问题,请问怎么回事啊?谢谢阿~~
|
在Linux下可以正常运行``
应该是运行环境的问题``
应该是运行环境的问题``