Gtk 2.0 compilierungs problem
-
Hi leutz,
hoffe ihr könnt mir helfen.Wenn ich ein gtk prog mit dem aufruf gcc test.c -o test 'pkg-config --cflags --libs gtk+-2.0' compilieren möchte bekomme ich folgende fehler meldung:
gcc -g test.cpp -o test 'pkg-config --cflags --libs gtk+-2.0'
gcc: pkg-config --cflags --libs gtk+-2.0: Datei oder Verzeichnis nicht gefunden
test.cpp:1:21: gtk/gtk.h: Datei oder Verzeichnis nicht gefunden
test.cpp: In functionint main(int, char**)': test.cpp:4: error:
GtkWidget' undeclared (first use this function)
test.cpp:4: error: (Each undeclared identifier is reported only once for each
function it appears in.)
test.cpp:4: error:window' undeclared (first use this function) test.cpp:6: error:
gtk_init' undeclared (first use this function)
test.cpp:8: error:GTK\_WINDOW\_TOPLEVEL' undeclared (first use this function) test.cpp:8: error:
gtk_window_new' undeclared (first use this function)
test.cpp:9: error:G_OBJECT' undeclared (first use this function) test.cpp:9: error:
gtk_main_quit' undeclared (first use this function)
test.cpp:9: error:G_CALLBACK' undeclared (first use this function) test.cpp:10: error:
NULL' undeclared (first use this function)
test.cpp:10: error:g\_signal\_connect' undeclared (first use this function) test.cpp:12: error:
gtk_widget_show' undeclared (first use this function)
test.cpp:14: error: `gtk_main' undeclared (first use this function)Wenn ich aber in der shell pkg-config --cflags --libs gtk+-2.0 aufrufe bekomme ich die jeweiligen pfade korrekt angezeigt.
Weiß evtl. jemand woran das liegt?
-
Du musst backticks verwenden
gcc test.c -o test `pkg-config --cflags --libs gtk+-2.0`
-
Danke, ich wäre nie imleben drauf gekommen, das ich backsticks statt hochkommata nehmen muss.