[問題] 請問在mac上使用gtk OTZ
小弟我想在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
推
11/26 02:54, , 1F
11/26 02:54, 1F
→
11/26 02:59, , 2F
11/26 02:59, 2F
→
11/26 03:00, , 3F
11/26 03:00, 3F
推
11/26 10:17, , 4F
11/26 10:17, 4F
→
11/26 10:18, , 5F
11/26 10:18, 5F
→
11/26 11:57, , 6F
11/26 11:57, 6F
→
11/26 13:27, , 7F
11/26 13:27, 7F
推
11/26 23:05, , 8F
11/26 23:05, 8F
→
11/27 00:41, , 9F
11/27 00:41, 9F
推
01/02 09:35, , 10F
01/02 09:35, 10F
→
01/02 09:36, , 11F
01/02 09:36, 11F
討論串 (同標題文章)
以下文章回應了本文:
完整討論串 (本文為第 1 之 2 篇):
MacDev 近期熱門文章
PTT數位生活區 即時熱門文章