有人可以帮助我在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