gtkmm on Microsoft Windows
Contents
Download
There are Installers available for gtkmm on Microsoft Windows.
Installer Descriptions
gtkmm-win32-runtime-*.exe contains dynamic libraries (DLLs) of gtkmm, libxml++ and libglademm and all their dependencies. You need this to run programs using gtkmm if those programs don't distribute gtkmm themselves.
gtkmm-win32-devel-*.exe contains the same as the runtime package, plus header files, import libraries and documentation. You need this to compile applications or libraries that use gtkmm on Windows, with either MinGW or MSVC++. If you install this package, then you don't need the runtime one.
Using the Installers
To use the runtime environment, simply execute the installer and make sure the "Add the gtkmm runtime directory to the PATH variable" option is checked. This is required for Windows to find the gtkmm DLL files. If you know what you do, then you can also uncheck that option. This can be useful if you have multiple versions of gtkmm installed (for example, both runtime and development DLLs) and want to choose which one to use by setting the PATH variable manually. After installing, you are able to run programs using gtkmm.
To use the development environment, you need to know with which compiler you want to compile your application. MinGW and Visual C++ 2005 (or later) are supported. Older versions of Visual C++ are not supported, and are not likely to work.
Both packages contain the GTK+ runtime and its dependencies, and the development package also contains GTK+ header files, import libraries and documentation. You don't need to install anything else to use the packages.
All DLLs are installed into the bin/ subfolder in the installation directory.
MinGW DLLs
The DLLs prefixed with lib, such as libgtkmm-2.4-1.dll, are required if you build your application with MinGW.
The MinGW DLLs were built with g++ version 3.4.5. It is not guaranteed that other versions of g++ will work with the built binaries. Especially, we experienced the problem that exceptions thrown by glibmm or gtkmm could not be caught in applications built with g++ 3.4.2, which is shipped with Dev-C++ by default.
MSVC++ DLLs
The DLLs without a lib prefix, such as gtkmm-2.4.dll are MSVC++ DLLs. The DLLs without a d suffix are required for the Release configuration if you build your application with MSVC++. The DLLs with a d suffix, such as gtkmm-2.4d.dll, are MSVC++ debug DLLs. These are required for the Debug configuration of MSVC++-built applications.
The MSVC++ DLLs were built with Visual C++ 2005 and are linked to the MS C/C++ runtime DLLs: MSVCR80.DLL / MSVCP80.DLL.
GTK+ DLLs
For GTK+ and its dependencies (these are most DLLs that do not end on *mm, except libsigc-2.0.dll and xml++-2.6.dll) the convention mentioned above is not valid. There is only one DLL for each library, but this one works with both MinGW and MSVC++ (both Debug and Release Target), because they are C libraries, not C++.
Using MinGW
To build your application with MinGW, we recommend that you use the MSYS shell. With MSYS, you can compile your program as on Unix, for example via g++ foo.cc -o foo `pkg-config --cflags --libs gtkmm-2.4`.
You could also use the normal Windows command line to do this, but the backticks syntax would not work, so you would need to run pkg-config separately and insert the correct flags by hand.
The installer only provides native Windows DLLs, not Cygwin DLLs. Instructions on how to build native gtkmm Windows applications using cygwin would be welcome.
Using MSVC++ (Microsoft Visual Studio)
To build your application with MSVC++, open the "Property manager" via "View / Property Manager" in the menu, then right click the debug target, select "Add existing property sheet", then navigate to the location to which you installed gtkmm, descend into the MSVC directory and choose the gtkmm-2.4d.vsprops file. Then, do the same for the release target, but choose gtkmm-2.4.vsprops.
To prevent random crashes in the debug version, go to "Project / $MyProject properties" in the menu, make sure the Debug configuration is active (upper left corner of the dialog), then go to "Configuration Properties / C/C++ / Code generation" and choose "Multi-threaded Debug" as Runtime Library. This is because your application needs to be built against the same runtime library as the gtkmm (debug) DLLs.
You might also want to change "Generate Debug Info" in "Linker / Debugging" to Yes to be able to debug your application. Both options don't seem to be default for the Debug configuration for new, empty projects. We don't know why.
To work around a compiler bug in Visual Studio (http://bugzilla.gnome.org/show_bug.cgi?id=158040), the /vd2 flag needs to be passed to the compiler. This is already done automatically for your application if you use the property sheets as mentioned above. However, you need to remember to do this if you don't use the property sheets for some reason.
Updating
When new versions of the installers are released, you can simply execute the new installer to update your gtkmm installation. The installer will detect a previous version of gtkmm and uninstall it first.
Installer Side Effects
Apart from installing files and directories to the hard disk, the installer does the following:
Set the GTKMM_BASEPATH environment variable. This is used to refer to the gtkmm header and library files in the MSVC property sheets.
Add the path to the gtkmm DLLs to the PATH environment variable. This is optional as explained in the first section.
Add the HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Uninstall\gtkmm key to the registry, with a few subkeys. This makes gtkmm appear in the list of installed applications in the "Add or Remove Programs" window.
Add the HKEY_LOCAL_MACHINE\Software\gtkmm key to the registry. This is used by the uninstaller to find the place where gtkmm has been installed.
Add the HKEY_CURRENT_USER\Software\gtkmm key to the registry. This is used to remember the installer language to use for updates.
For user-local installation, the registry keys are stored under HKEY_CURRENT_USER instead of HKEY_LOCAL_MACHINE.
Silent Installs
For silent installations (installation without requiring user intervention, using the /S flag) the following options can be used:
/D=GTKMM_PATH: Sets the installation path to GTKMM_PATH.
- /SET_ENVVARS: If this flag is set, then the path to the gtkmm DLL files will be added to the PATH environment variable.
- /ALLUSERS: Install for all users instead of a user-local installation.
Known problems
The Uninstaller will not remove Start Menu items.
Redistributing
For your application to work out of the box on other machines that don't have GTK+ or gtkmm installed you need to ship the following files with your application, perhaps using an installer. You should use the files from the runtime package, since they don't contain debug symbols. We suggest that you keep the directory structure of the installed files, so that GTK+ can correctly find its configuration files and modules.
This means that you'll have bin/, etc/, lib/ and share/ folders at the lop level of your package. Since all the DLLs are contained in bin/, this is were your application executable belongs as well. So it might end up in C:\Program Files\YourApplication\bin\YourApplication.exe on the target machine, depending on the installation directory. Most applications using GTK+ on Windows do this, such as GIMP.
Please do not install the DLL files into a global system path, such as C:\Windows\System32. Since GTK+ locates files it needs at runtime based on the path where the GTK+ DLL resides, you might also need to install other files, such as modules (image loaders, input modules, etc.) or theme settings into the same path. Also, if two different applications do this, then uninstalling one would need to make sure to keep the files in System32, so the other application does not break. Furthermore, the past has shown that new Glib or GTK+ versions on Windows are not always fully compatible with old ones, even though they try to be. This is improving, however.
gtkmm
You will need all these files for gtkmm:
bin\libgtkmm-2.4-1.dll or bin\gtkmm-2.4.dll (depending on whether you built your application with MinGW or MSVC++.)
bin\libgdkmm-2.4-1.dll or bin\gdkmm-2.4.dll
bin\libpangomm-1.4-1.dll or bin\pangomm-1.4.dll
bin\libatkmm-1.6-1.dll or bin\atkmm-1.6.dll
bin\libcairomm-1.0-1.dll or bin\cairomm-1.0.dll
bin\libgiomm-2.4-1.dll or bin\giomm-2.4.dll
bin\libglibmm-2.4-1.dll or bin\glibmm-2.4.dll
bin\libsigc-2.0-0.dll or bin\sigc-2.0.dll
GTK+ runtime
This is required by gtkmm, so you will need all these, too. A more detailed explanation of what all these libraries provide is available at the GTK+ for Windows page.
bin\libgtk-win32-2.0-0.dll
bin\libgdk-win32-2.0-0.dll
bin\libgdk_pixbuf-2.0-0.dll
bin\libpango-1.0-0.dll
bin\libpangocairo-1.0-0.dll
bin\libpangoft2-1.0-0.dll
bin\libpangowin32-1.0-0.dll
bin\libatk-1.0-0.dll
bin\libcairo-2.dll
bin\libgio-2.0-0.dll
bin\libgmodule-2.0-0.dll
bin\libgobject-2.0-0.dll
bin\libgthread-2.0-0.dll
bin\libglib-2.0-0.dll
bin\libpng12.dll
bin\intl.dll
bin\libtiff3.dll
bin\jpeg62.dll
bin\zlib1.dll
etc\pango\pango.modules: List of registered pango modules.
etc\gtk-2.0\gdk-pixbuf.loaders: List of available image loaders.
etc\gtk-2.0\gtk.immodules: List of available input modules for GTK+.
etc\gtkrc: Contains the GTK+ theme to use (the "MS-Windows" theme).
lib\gtk-2.0\2.10.0\* (All files and directories within this directory): These are GTK+ modules such as image loaders and theme engines loaded at runtime.
share\themes\MS-Windows\gtk-2.0\gtkrc: Theme settings for the MS-Windows GTK+ theme.
share\locale\*: Translations of glib and GTK+ into several languages.
libxml++
If your program uses libxml++ then you will additionally need:
bin\libxml++-2.6-1.dll or bin\xml++-2.6.dll
bin\libxml2.dll
bin\iconv.dll: This is required by libxml2.dll.
libglademm
If your program uses libglademm, then you will additionally need:
bin\libglademm-2.4-1.dll or bin\glademm-2.4.dll
bin\libglade-2.0-0.dll
Rebuilding
To rebuild the gtkmm binaries or to recreate the installer, see the Building gtkmm on Windows.
