OS:Fedora的18
內核:3.6.10-4.fc18.x86_64不能夠編譯GTK程序
我不能夠編譯一個簡單的GTK程序:
#include <gtk/gtk.h>
int main(int argc, char *argv[])
{
GtkWidget *window;
gtk_init(&argc, &argv);
window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_widget_show(window);
gtk_main();
return 0;
}
命令:
[[email protected] dir]##gcc -o graph graph.c `pkg-config --libs --cflags gtk+-2.0`
/lib64/libGL.so.1: undefined reference to _glapi_tls_Dispatch
collect2: error: ld returned 1 exit status
pkg-config --libs --cflags gtk + -2.0命令輸出顯示了什麼? –
-pthread -I/usr/include/gtk-2.0 -I/usr/lib64/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng15 -I/usr/include/libdrm -I/usr/include/harfbuzz -lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lgio-2.0 - lpangoft2-1.0 -lpangocairo-1.0 -lgdk_pixbuf-2.0 -lcairo -lpango-1.0 -lfreetype -lfontconfig -lgobject-2.0 -lglib-2.0 – duck