User Tools

Site Tools


Building a GTK+ application on Win32 using MinGW (by example)

This is a step-by-step guide for building a GTK+ application on Win32 using Minimalist GNU for Windows (MinGW). I will do that by example, namely DFCGen (GTK+).

  1. Download MinGW from and install it on your Win32 operating system (i installed MinGW 20110802, using the associated installer mingw-get-inst-20110802.exe).1)
  2. Download an all-in-one GTK+ bundle from and extract the archive directly into the MinGW installation directory. Note: Be careful when overwriting files. I had some problems with intl/gettext, because MinGW installed libintl v1.2, but GTK wants to overwrite this with v1.1.
  3. Start the MinGW shell (MSYS) and enter gtk-demo to verify your installation.
  4. Download additional tarball source packages (at this example GSL from and extract it into a directory anywhere.
  5. In MSYS shell change to that directory and do a package build:2)
    ./configure --prefix=/mingw; make; make install
  6. Extract the tarball distribution package, in this example dfcgen-gtk-0.4.tar.gz to a directory, which is reachable by the MSYS shell.
  7. In MSYS shell change to that directory and build the package (but do NOT a make install):
    ./configure; make
  8. Now some handy work comes into play:
    • First create a new directory for gathering all Win32 installation files.
    • Copy the generated executable dfcgen-gtk.exe into this directory and change to it.
    • Copy the following directories from MinGW into this “gathering” pool:
      • /mingw/etc./etc
      • /mingw/lib/gtk-2.0./lib/gtk-2.0
    • Create a sub-directory share and copy the following directories from dfcgen-gtk-0.4 in:3)
      • data/filtersshare/filters
      • data/pixmapsshare/pixmaps
      • data/templatesshare/templates
    • Start dfcgen-gtk.exe from a DOS shell or from the file manager. This will produce an error, stating that a DLL is missing. Typically this is a DLL from the GTK+ package, which can be found anywhere under /mingw (probably in /mingw/bin). Copy the DLL also into the directory where dfcgen-gtk.exe now resides.
    • Start dfcgen-gtk.exe again and repeat the procedure (until no error).
    • If you want another language than English (internationalization, i18n, locale, intl/gettext) copy also the following directories:
      • from the MinGW installation: /mingw/share/locale/de/LC_MESSAGES./share/locale/de/LC_MESSAGES
      • from the dfcgen-gtk build directory: po/ (file renamed).
  9. Copy the “gathering” directory to your final Win32 installation directory, e.g. C:\programs\dfcgen-gtk. You can start dfcgen-gtk.exe directly from this location (or create a shortcut on your desktop).
Source code is hosted at
If you enter mount then you will see that C:\MinGW is mounted on /mingw.
The sub-directory name “share” is preset by the Win32 port of GTK.
development/build/compile-mingw.txt · Last modified: 2012/12/09 14:14 (external edit)