centos中gtk安装及编译

安装

yum -y install gtk2 gtk2-devel gtk2-devel-docs

编写测试程序hello.c

#include 

int main(int argc, char *argv[])
{
        GtkWidget *windows;
        gtk_init(&argc,&argv);
        windows = gtk_window_new(GTK_WINDOW_TOPLEVEL);
        gtk_widget_show(windows);
        gtk_main();
        return 0;
}

编译

gcc -o hello  hello.c `pkg-config --libs --cflags gtk+-2.0`

你可能感兴趣的:(centos中gtk安装及编译)