Building gtkmm on Windows

This page describes how to build gtkmm from source code on Windows, and how to recreate the official installer. Not many people will need to do that. If you just want to install gtkmm DLLs (binaries) then please see the gtkmm on Windows page instead.

Before building gtkmm on Windows, you will need GTK+ to be available. We suggest that you install the GTK+ all-in-one bundle from If you plan to create the gtkmm installer, then it would be wise to install it to a subdirectory called "bundle" into the MSYS installation, since this is where the installer script picks up the files for the installer. You can also change the installer script, though, if you install it elsewhere.

If you are trying to build the latest (probably) unstable gtkmm 3.1.x with MS VC++, bundle may not catch up with the development of Gtk+. In this case you may consider mixed build of Gtk+ 3.1 with MS VC++ to avoid (re-)building of all its prerequisites. Be prepared to adjust MSVC project files as some files are not there and some new ones are not included yet. Though you will get working gtkmm this way, some features may remain broken. This approach is recommended only to start developing/debugging your applications (or gtkmm) on Win32 platform before the official release of gtkmm. You may also give a try to build GTKMM with Visual C++ using CMake.

Using MinGW

If you decide to build gtkmm with MinGW, then we suggest that you use MSYS to do so.

If you did not install the GTK+ bundle to a location already known to MSYS, you will need to add the path to pkg-config.exe (contained in the GTK+ bundle) to your PATH variable. Since, by default, the built libraries will install to /usr/local, it is also a good idea to add this to PKG_CONFIG_PATH, so pkg-config will find the installed self-built libraries. You can do this by creating a .profile file in your home directory, with content similar to this:


This will take effect as soon as you re-login into MSYS. Of course, you will need to adjust the path to the directory where you unzipped the GTK+ bundle into.

Next, check your make version

make --version

If it's less than 3.81 then it does not support features required by newer glibmm/gtkmm tarballs. In this case, get the a newer make version from MinGW under MSYS base system/Current Release. Do not use GNU make found on the same page. Unpack the tarball into your base MSYS directory, overwriting the existing make.exe.

Building gtkmm with MinGW is pretty straightforward from that point onwards: Download the tarballs for libsigc++, glibmm, cairomm, pangomm, atkmm and gtkmm, unpack them and run

./configure && make && make install

in each one, obeying the order in which the packages are listed above.

Using MSVC++

Note that only Visual C++ 2005 or later is supported. Older versions are not likely to work.

For MSVC++, you will need to setup the compiler's include and library paths, so it can find the include files and import libraries of GTK+ and its dependencies. To do this, in MSVC 2005 and 2008 choose "Tools / Options" from the Menu, then "Projects and Solutions" and "VC++ Directories". In MSVC 2010 click on the "Property Manager" tab on the left, then right-click the Microsoft.Cpp.Win32.user property sheet for one of the projects, then choose "VC++ Directories" in the popup window. On the right hand side in the dialog, show directories for "Include files" and add the paths to GTK+'s header files. These are several paths. You will probably need to add:

  • $bundle\include
  • $bundle\include\freetype2
  • $bundle\include\glib-2.0
  • $bundle\lib\glib-2.0\include
  • $bundle\include\cairo
  • $bundle\include\pango-1.0
  • $bundle\include\atk-1.0
  • $bundle\include\gtk-2.0
  • $bundle\lib\gtk-2.0\include

You need to substitute $bundle with the path you extracted the GTK+ all-in-one bundle to, of course.


Then, show directories for "Library files" and add $bundle\lib to the list of paths. If you intend do both 32 bit and 64 bit builds then you'll have to do this step twice once for 32 bit and once for 64 bit.

Now, Visual Studio is set up to compile gtkmm. Download the tarballs for libsigc++, glibmm, cairomm, pangomm, atkmm and gtkmm. You will need to build the packages in this order.

In each of the tarballs you will find a MSVC_Net2005, a MSVC_Net2008 and a MSVC_Net2010 subdirectory with a MSVC solution file in each of it. Open the solution file for your Version of MSVC++ and build the project. When done, you will need to make the built import libraries and header files available for packages requiring them (for example, glibmm requires libsigc++), by adding the path to the include files and import libraries to the Visual C++ directories, as described above for the GTK+ files.

You will normally need to add two import library paths (for Release and Debug versions) and two include paths (one for the normal include files, such as $glibmm/glib and one to the config files, which is in $glibmm/MSVC_Net2005/glibmm, with $glibmm specifying the location where you extracted the glibmm tarball to). Note also that some packages consist of multiple libraries (for example, glibmm contains glibmm and giomm). You will need to add the paths for each library.

Alternatively, you can set up a directory to which you copy all the built binaries and header files, so you only have to add one path to the Visual C++ Directories.

Building the installer

To build the gtkmm installer, you will need to build all MinGW, MSVC++ 2005, MSVC++ 2008 and MSVC++ 2010binaries, and both Debug and Release targets for all three MSVC++ versions. You will also need to build libxml++ and libglademm, since the installer also contains these two libraries. Doing this works the same way as building all the other libraries above. You also need to do two MinGW builds: One with ./configure CXXFLAGS="-O0 -g" --prefix=/win32/gtkmm_debug and one with ./configure CXXFLAGS="-O2" --prefix=/win32/gtkmm_release (or /win64/gtkmm_debug and /win64/gtkmm_release for the 64 bit installer). The latter one is used for the redist/ files.

gtkmm-documentation cannot be built on Windows, since gnome-doc-utils does not work on Windows. Build it on a Linux machine, install it to a separate prefix, and copy it into $msys/win32/gtkmm_debug and/or $msys/win64/gtkmm_debug.

All you need to do is to install some additional C libraries, preferably to the same place where you installed the GTK+ bundle to, so you don't need to add new paths to ~/.profile or the Visual C++ Directories. You will need: libxml2 and libxml2-dev from here and both runtime and development files for libglade.

libglade does not come with a MSVC++ import library, so you will need to create one. To do this, download the libglade source tarball. Then, start the Visual Studio Command Prompt (it is in the Visual Studio entry in the start menu) and navigate to the unzipped libglade tarball and descend into the glade directory. Finally, type

lib /Def:glade.def /Out:glade-2.0.lib /Name:libglade-2.0-0.dll

Copy the generated glade-2.0.lib into the lib/ subdirectory of the unzipped libglade binaries.

If you finished building libxml++ and libglademm, go to the unpacked gtkmm tarball and descend into the win32_installer/ subdirectory in MSYS. There is a ./ script that produces both the development and runtime installers if everything is set up correctly. It takes one argument which should be either 'win32' to build the 32 bit installer or 'win64' to build the 64 one. The script makes the following assumptions (replace win32 by win64 for the 64 bit installer):

  • The GTK+ bundle has been extracted to $msys/win32/bundle ($msys being the MSYS installation path), libxml2 into $msys/win32/libxml2, libglade into $msys/win32/libglade. The generated glade-2.0.lib is expected to be in $msys/win32/libglade/lib.
  • All the self-built libraries (libsigc++, glibmm, cairomm, pangomm, gtkmm, libxml++, libglademm) have been installed to /win32/gtkmm_debug and /win32/gtkmm_release. For the debug build documentation was enabled (--enable-documentation to configure) and for the release builds it was not.
  • All the tarballs have been extracted to the same directory where gtkmm has been extracted. This is expected to copy the built MSVC++ files from the respective MSVC_Net2005/, MSVC_Net2008/ and MSVC_Net2010 subdirectories.
  • The tarball versions of the libraries used are hardcoded in the script. If you used different versions, then you will have to adjust it.
  • NSIS is installed on the system, and the makensis binary is in the PATH.

If the script fails, have a look at the error message and check whether you have fulfilled all the points above. If problems remain, feel free to ask on the mailing list.

Attic/BuildingGtkmmOnWindows (last edited 2015-05-25 12:26:06 by SvitozarCherepii)