Compilando e executando o aplicativo GTK + no Windows 7
Sistema: Windows7, 32 bits, GTK 2.24.10, mingw
Eu estou tentando escrever uma aplicação básica baseada em GTK helloworld.c tipo. No entanto, não é executado.
Estes são os passos que eu segui.
D: \ gtk> gcc -o projeto helloworld.c% GTK%
gcc:% GTK%: Nenhum arquivo ou diretório helloworld.c: 1: 21: erro: gtk / gtk.h: Nenhum arquivo ou diretório helloworld.c: Na função 'main': helloworld.c: 5: error: 'GtkWidget' não declarado (primeiro uso nesta função) helloworld.c: 5: erro: (Cada identificador não declarado é relatado apenas uma vez helloworld.c: 5: erro: para cada função aparece dentro.) Helloworld.c: 5: erro : 'window' não declarado (primeiro uso nesta função) helloworld.c: 9: erro: 'GTK_WINDOW_TOPLEVEL' não declarado (primeiro uso nesta função)
D:\gtk>gcc -Wall -g helloworld.c -o helloworld pkg-config --cflags gtk+-2.0 pkg-config --libs gtk+-2.0
gcc: pkg-config: No such file or directory
gcc: gtk+-2.0: No such file or directory
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"
arquivo em lote em D: \ gtk
set GTK=-mms-bitfields -IC:/gtk/include/gtk-2.0 -IC:/gtk/lib/gtk-2.0/include -IC:/gtk/include/atk-1.0 -IC:/gtk/include/cairo -IC:/gtk/include/gdk-pixbuf-2.0 -IC:/gtk/include/pango-1.0 -IC:/gtk/include/glib-2.0 -IC:/gtk/lib/glib-2.0/include -IC:/gtk/include -IC:/gtk/include/freetype2 -IC:/gtk/include/libpng14 -LC:/gtk/lib -lgtk-win32-2.0 -lgdk-win32-2.0 -latk-1.0 -lgio-2.0 -lpangowin32-1.0 -lgdi32 -lpangocairo-1.0 -lgdk_pixbuf-2.0 -lpango-1.0 -lcairo -lgobject-2.0 -lgmodule-2.0 -lgthread-2.0 -lglib-2.0 -lintl
start cmd
helloworld.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_widget_show (window);
gtk_main ();
return 0;
}
Referência:Instalando o gtk e compilando usando o gcc no windows?