【发布时间】:2010-01-30 22:28:10
【问题描述】:
有人可以帮我在 Vista cmd 提示符下编译 gtk+ (& gtkmm) 吗? 我最近尝试过,无法让它工作。我觉得我的所有依赖项和路径都是正确的,但我显然没有或遗漏了什么!我已经搜索了互联网,但没有找到具体的帮助(我也在尝试在 cygwin 中编译,但已经成功编译并在 MSYS 中运行了简单的 helloworld gtk+ 示例)。
我通过 MinGW & Gtk+ Win32 dev (Glade) & Gtkmm Win32 安装了 gcc。以下是一些示例 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 vis C express 编译器(或任何 MSWindows7 SDK 编译器 - 因为我也安装了它?!)。我只是一个初学者/业余程序员,但确实想为 GUI 编程编写 gtk+/gtkmm 代码,并且希望能够在 cmd 提示符下编译以及使用 IDE 进行编码和编译/运行。
感谢并期待有帮助的回复,非常感谢
【问题讨论】: