|
楼主 |
发表于 2012-3-12 10:12:40
|
显示全部楼层
哎,搞了一整天,终于搞定了!!
貌似我最终找到了一个windows下的libglade不过运行时出错了!
按楼上的建议,用了GtkBuilder,果然成功了,而且不需要glade.h。
测试代码如下;
(貌似test.glade不用转换成test.xml也行)
#include <stdlib.h>
#include <gtk/gtk.h>
void on_window_destroy (GtkObject *object, gpointer user_data)
{
gtk_main_quit ();
}
int main (int argc, char *argv[])
{
GtkBuilder *builder;
GtkWidget *window;
gtk_init(&argc, &argv);
builder =gtk_builder_new();
gtk_builder_add_from_file (builder, "test.xml", NULL);
window = GTK_WIDGET (gtk_builder_get_object (builder, "window"));
gtk_builder_connect_signals(builder, NULL);
g_object_unref(G_OBJECT(builder));
gtk_widget_show(window);
gtk_main ();
return 0;
} |
|