看板 MacDev 關於我們 聯絡資訊
小弟我想在macbook上寫gtk的程式 於是利用macport sudo port install gtk2 螢幕顯示了 Skipping org.macports.activate (gtk2 +x11) since this port is already active ---> Cleaning gtk2 似乎是說我已經安裝好了 接著我參考了這個網站 http://caterpillar.onlyfun.net/Gossip/GTKGossip/FirstGTK.html 編譯了以下的程式碼 //helloGtk.c #include <gtk/gtk.h> int main(int argc, char *argv[]) { GtkWidget *window; gtk_init(&argc, &argv); window = gtk_window_new(GTK_WINDOW_TOPLEVEL); gtk_window_set_title(GTK_WINDOW(window), "哈囉!GTK+!"); gtk_widget_show(window); gtk_main(); return 0; } 編譯的指令如下: $gcc helloGtk.c -o helloGtk 'pkg-config --cflags --libs gtk+-2.0' 他給我如下的訊息: i686-apple-darwin9-gcc-4.0.1: pkg-config --cflags --libs gtk+-2.0: No such file or directory helloGtk.c:1:21: error: gtk/gtk.h: No such file or directory helloGtk.c: In function ‘main’: helloGtk.c:4: error: ‘GtkWidget’ undeclared (first use in this function) helloGtk.c:4: error: (Each undeclared identifier is reported only once helloGtk.c:4: error: for each function it appears in.) helloGtk.c:4: error: ‘window’ undeclared (first use in this function) helloGtk.c:7: error: ‘GTK_WINDOW_TOPLEVEL’ undeclared (first use in this function) 小弟是新手,不知道有沒有哪位大大教我怎麼在mac上安裝gtk及編譯gtk程式 感謝感謝 <(__)> -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 140.112.243.43
ducksteven:pkg-config 會是 linux 專屬的指令嗎? 11/26 02:54
operationcow:不是很了解 @@>?? 11/26 02:59
operationcow:我直接gcc helloGtk.c -o helloGtk也不行 OTZ 11/26 03:00
jlovet:你有設定PATH嗎 /opt/usr/bin之類的... 11/26 10:17
jlovet:macport的程式都裝到這裡... 11/26 10:18
yllan:你沒有指定 header 檔的 search path 11/26 11:57
operationcow:請問要怎麼指定@@>?? 感謝感謝 OTZ 11/26 13:27
jclin:我的有pkg-config. header可能要指定-I/opt/local/include 11/26 23:05
yllan:嗯,而且應該是 ` 不是 ' 11/27 00:41
bizkit:找一下gtk的.pc擋在哪裡 加到PKG_CONFIG_PATH 01/02 09:35
bizkit:例如/usr/lib/pkgconfig /usr/X11/lib/pkgconfig 之類的 01/02 09:36