无法在Windows上构建gtk

时间:2013-12-03 20:18:20

标签: gtk

我安装了minGW,适用于构建直接的C ++程序。

现在我按照此处的说明安装GTK:http://www.gtk.org/download/win32_tutorial.php

我从这里抓住了一个GTK hellow world程序:https://developer.gnome.org/gtk-tutorial/stable/c39.html#SEC-HELLOWORLD

但是当我尝试构建它时,使用此命令

C:\Users\James\code\smartone>gcc -o hello.exe gtk_hello_world.c -mms-bitfields
IC:/gtk/include/gtk-3.0 -IC:/gtk/include/cairo -IC:/gtk/include/pango-1.0 -IC:/
tk/include/atk-1.0 -IC:/gtk/include/cairo -IC:/gtk/include/pixman-1 -IC:/gtk/in
lude -IC:/gtk/include/freetype2 -IC:/gtk/include -IC:/gtk/include/libpng15 -IC:
gtk/include/gdk-pixbuf-2.0 -IC:/gtk/include/libpng15 -IC:/gtk/include/glib-2.0
IC:/gtk/lib/glib-2.0/include -LC:/gtk/lib -lgtk-3 -lgdk-3 -lgdi32 -limm32 -lshe
l32 -lole32 -Wl,-luuid -lpangocairo-1.0 -lpangoft2-1.0 -lfreetype -lfontconfig
lpangowin32-1.0 -lgdi32 -lpango-1.0 -lm -latk-1.0 -lcairo-gobject -lcairo -lgdk
pixbuf-2.0 -lgio-2.0 -lgobject-2.0 -lglib-2.0

我收到这些错误

c:/mingw/mingw/bin/../lib/gcc/x86_64-w64-mingw32/4.8.1/../../../../x86_64-w64-mi
ngw32/bin/ld.exe: skipping incompatible C:/gtk/lib/libgtk-3.dll.a when searching
 for -lgtk-3
c:/mingw/mingw/bin/../lib/gcc/x86_64-w64-mingw32/4.8.1/../../../../x86_64-w64-mi
ngw32/bin/ld.exe: skipping incompatible C:/gtk/lib/libgtk-3.dll.a when searching
 for -lgtk-3
c:/mingw/mingw/bin/../lib/gcc/x86_64-w64-mingw32/4.8.1/../../../../x86_64-w64-mi
ngw32/bin/ld.exe: cannot find -lgtk-3

... etc, etc, etc

我错过了什么?

1 个答案:

答案 0 :(得分:3)

您正在使用64位编译器。使用gcc的-m32 option以32位模式使用64位编译器构建。