在Clion中c ++编译GTK + Glade代码时出错

时间:2017-08-21 08:58:08

标签: c++ gtk glade

在编译此代码时遇到一些问题

    #include <iostream>
#include <gtk/gtk.h>
using namespace std;



int main(int argc,char *argv[]) {
    GtkBuilder* builder;
    GtkWidget* window;
    gtk_init(&argc,&argv);

    builder=gtk_builder_new();
    gtk_builder_add_from_file(builder,"main.glade",NULL);
    window=GTK_WIDGET(gtk_builder_get_object(builder,"window1"));

    gtk_builder_connect_signals(builder,NULL);
    g_object_unref(G_OBJECT(builder));
    gtk_widget_show(window);

    gtk_main();

    return 0;
}

如果我用

编译它
 g++ -o gladewin main.cpp -Wall `pkg-config --cflags --libs gtk+-3.0` -export-dynamic

没关系。但如果我在CLion中这样做,我会收到此错误

): Gtk-CRITICAL **: gtk_widget_show: assertion 'GTK_IS_WIDGET (widget)' failed

0 个答案:

没有答案