有人可以幫助我在Vista cmd提示符下編譯gtk +(& gtkmm)嗎? 我最近試過&無法得到這個工作。我覺得我有所有的依賴和路徑正確,但我顯然沒有或缺少一些東西!我搜索了互聯網,但沒有找到具體的幫助(我也試圖在cygwin中編譯 - 但已成功編譯&在MSYS中運行簡單的helloworld gtk +示例)。在Vista中編譯gtk +&gtkmm在cmd提示符
我已通過MinGW安裝gcc & Gtk + Win32 dev(Glade)&已安裝Gtkmm Win32。以下是一些示例cmd提示輸出,以顯示我遇到的問題:
D:\RPD_Programming\RPD_HelloWorld\RPD_Gtk_helloworld>gcc helloworld.c -o hellowo
rld
helloworld.c:1:21: gtk/gtk.h: No such file or directory
helloworld.c:5: error: syntax error before '*' token
helloworld.c:11: error: syntax error before "delete_event"
helloworld.c:11: error: syntax error before '*' token
helloworld.c: In function `delete_event':
helloworld.c:26: error: `TRUE' undeclared (first use in this function)
helloworld.c:26: error: (Each undeclared identifier is reported only once
helloworld.c:26: error: for each function it appears in.)
helloworld.c: At top level:
helloworld.c:30: error: syntax error before '*' token
helloworld.c: In function `main':
helloworld.c:40: error: `GtkWidget' undeclared (first use in this function)
helloworld.c:40: error: `window' undeclared (first use in this function)
helloworld.c:41: error: `button' undeclared (first use in this function)
helloworld.c:48: error: `GTK_WINDOW_TOPLEVEL' undeclared (first use in this func
tion)
helloworld.c:56: error: `NULL' undeclared (first use in this function)
helloworld.c:80: error: `gtk_widget_destroy' undeclared (first use in this funct
ion)
D:\RPD_Programming\RPD_HelloWorld\RPD_Gtk_helloworld>gcc helloworld.c -o hellowo
rld pkg-config --cflags --libs gtk+-2.0
gcc: pkg-config: No such file or directory
gcc: gtk+-2.0: No such file or directory
cc1.exe: error: unrecognized command line option "-fcflags"
cc1.exe: error: unrecognized command line option "-flibs"
D:\RPD_Programming\RPD_HelloWorld\RPD_Gtk_helloworld>gcc --v
Reading specs from C:/MinGW/bin/../lib/gcc/mingw32/3.4.5/specs
Configured with: ../gcc-3.4.5-20060117-3/configure --with-gcc --with-gnu-ld --wi
th-gnu-as --host=mingw32 --target=mingw32 --prefix=/mingw --enable-threads --dis
able-nls --enable-languages=c,c++,f77,ada,objc,java --disable-win32-registry --d
isable-shared --enable-sjlj-exceptions --enable-libgcj --disable-java-awt --with
out-x --enable-java-gc=boehm --disable-libgcj-debug --enable-interpreter --enabl
e-hash-synchronization --enable-libstdcxx-debug
Thread model: win32
gcc version 3.4.5 (mingw-vista special r3)
D:\RPD_Programming\RPD_HelloWorld\RPD_Gtk_helloworld>pkg-config --version
0.23
D:\RPD_Programming\RPD_HelloWorld\RPD_Gtk_helloworld>which pkg-config
/cygdrive/c/Gtk+/bin/pkg-config
D:\RPD_Programming\RPD_HelloWorld\RPD_Gtk_helloworld> echo %PKG_CONFIG_PATH%
C:\Gtk+\lib\pkgconfig
是否已安裝pkg-config?我是否使用正確的編譯命令語法? 我可以使用MS與C Express編譯器(或者其他MSWindows7 SDK編譯器 - 因爲我也安裝了?!)。我只是一個初學者/業餘編程人員,但是想爲GUI編程編寫gtk +/gtkmm代碼,希望能夠在cmd提示符下編譯以及使用IDE編譯&編譯/運行。
我很感謝並期待有幫助的回覆,非常感謝
我沒有使用makefile,因爲我只是想編譯一個簡單的gtk + helloworld gui example-only一個簡單的文件。這給了我一場巨大的掙扎(在Vista cmd提示符和cygwin中)!我確定有一個合理的編譯命令來做到這一點 - 但我不知道它是什麼! 我一定會考慮使用Cmake並嘗試你的.bat文件替代方案(如果我必須訴諸這種事情,我將不得不使用IDE即DevC或其他)。非常感謝您的有用答覆 – rpd 2010-01-31 17:45:45