title: Compiling and running GTK+ application on Windows 7
body: <p>System: Windows7, 32 bit, GTK 2.24.10, mingw<br>
  I am trying to write basic helloworld.c type GTK based application. However, it doesn't run.<br>
  These are the steps which I followed.  </p>
  
  <ol>
  <li>Install MinGW.</li>
  <li>Download GTK+ all in one bundle.</li>
  <li>Extract content in C:\gtk folder.</li>
  <li>Open cmd and go to C:\gtk\bin directory and run pkg-config --cflags --libs gtk+-win32-2.0</li>
  <li>It prints list of compilation flags, and libraries to link your
  project to.
  Copy them and create a bath file as follows.
  set VAR=FLAGS
  start cmd
  where VAR = GTK, and FLAGS = output of the previous command (pkg-config).
  When you want to compile file use command : gcc foo.c %VAR%   </li>
  </ol>
  
  <p>D:\gtk>gcc -o project helloworld.c %GTK%<br>
  gcc: %GTK%: No such file or directory
  helloworld.c:1:21: error: gtk/gtk.h: No such file or directory
  helloworld.c: In function 'main':
  helloworld.c:5: error: 'GtkWidget' undeclared (first use in this function)
  helloworld.c:5: error: (Each undeclared identifier is reported only once
  helloworld.c:5: error: for each function it appears in.)
  helloworld.c:5: error: 'window' undeclared (first use in this function)
  helloworld.c:9: error: 'GTK_WINDOW_TOPLEVEL' undeclared (first use in this function)</p>
  
  <pre><code>D:\gtk&gt;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"
  </code></pre>
  
  <p>batch file in D:\gtk </p>
  
  <pre><code>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
  </code></pre>
  
  <p>helloworld.c</p>
  
  <pre><code>#include &lt;gtk/gtk.h&gt;
  
  int main( int   argc,
            char *argv[] )
  {
      GtkWidget *window;
  
      gtk_init (&amp;argc, &amp;argv);
  
      window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
      gtk_widget_show  (window);
  
      gtk_main ();
  
      return 0;
  }
  </code></pre>
  
  <p>Reference : <a href="https://stackoverflow.com/questions/1450445/installing-gtk-and-compiling-using-gcc-under-windows?lq=1">Installing gtk and compiling using gcc under windows?</a></p>