glade3 和gtk+3.0 联系不上,求助!!!
#include <gtk/gtk.h>
int main(int argc, char *argv[])
{
GtkBuilder *builder;
GtkWidget *window;
gtk_init(&argc, &argv);
builder = gtk_builder_new();
if ( !gtk_builder_add_from_file(builder,"/homework/abitno.glade", NULL)) {
printf("connot load file!");
}
gtk_builder_add_from_file (builder, "/homework/abitno.glade", NULL);
window = gtk_window_new(GTK_WINDOW_TOPLEVEL); //实例化
window = GTK_WIDGET(gtk_builder_get_object (builder, "homework"));
g_object_unref(G_OBJECT(builder));
gtk_widget_show_all(window);
gtk_main();
return 0;
}
编译时通过。
运行时出错。
gtk_widget_show_all:assertion ‘GTK_IS_WIDGET (widget)’ failed