[ 中文 ]
gtkmm on Microsoft Windows
gtkmm-win32-devel-*.exe contains the dynamic libraries (DLLs) of gtkmm, libxml++, libglademm and all their dependencies, 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++.
gtkmm-win64-devel-*.exe contains the same for 64 bit builds with mingw-w64 or MSVC's x64 target platform.
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.
First, execute the installer. When you intend to use MinGW, then install to a path not containing spaces (so C:\Program Files\Something is a bad idea) since pkg-config has problems with this. See also this mailing list post. To use the development environment, you need to know with which compiler you want to compile your application. MinGW-W64 (note that despite its name the MinGW-W64 project also provides a toolchain to build 32 bit executables) and Visual C++ 2005 (or later) are supported. Older versions of Visual C++ are not supported, and are not likely to work.
The package contains the GTK+ runtime and its dependencies, and also GTK+ header files, import libraries and documentation. You don't need to install anything else to use the package.
All required DLLs are installed into the bin/ subfolder in the installation directory. Additional DLLs are installed into the redist/ subfolder. These are required when redistributing your application, see the section below.
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 the MinGW-W64 32 Bit or 64 Bit toolchain, respectively. It is not guaranteed that other versions of g++ will work with the built binaries, but they probably do if they are configured to use the same ABI (such as SJLJ stack unwinding). Please let us know if you make positive or negative experiences with these binaries and another version of the GNU compiler.
The DLLs from installer contain debug symbols which might be useful when debugging your application with gdb.
The DLLs without a lib prefix, such as gtkmm-vc80-d-2_4.dll are MSVC++ DLLs. The DLL naming convention is module-toolset-(d-)abiversion.dll, where module means the library the DLL contains (such as glibmm, cairomm or gtkmm), toolset means the compiler used to build the DLL (which implies the runtime it is linked against) and abiversion is the ABI version of the library.
Debug DLLs have a d between the toolset and the abiversion. They are required for running the Debug configuration of MSVC++-built applications whereas the DLLs without d are required for the Release configuration.
The MSVC++ DLLs with toolset vc80 (built with MSVC++ 2005) are linked against the runtime DLLs MSVCR80.DLL / MSVCP80.DLL, the ones with vc90 as toolset (built with MSVC++ 2008) are linked against the runtime DLLs MSVCR90.DLL / MSVCP90.DLL and the ones with vc100 as toolset (built with MSVC++ 2010) are linked against the runtime DLLs MSVCR100.DLL / MSVCP100.DLL.
The MSVC++ release DLLs are the same in the runtime and development installers.
For GTK+ and its dependencies (these are most DLLs that do not end on *mm, except libsigc-2.0.dll and xml++-toolset-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++.
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)
The following are rough instructions on how to setup MSVC++ to build gtkmm applications. There are more detailed instructions on the Using gtkmm with Microsoft Visual Studio page.
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 corresponding .vsprops file (or .props for MSVC 2010) for your Visual Studio Version. Users of MSVC++ 2005 should use the gtkmm-vc80-d-2_4.vsprops file, users of MSVC++ 2008 should use the gtkmm-vc90-d-2_4.vsprops file and users of MSVC++ 2010 should use the gtkmm-vc100-d-2_4.vsprops file. Then, do the same for the release target, but choose the version without d in the filename. The gtkmm-2.4.vsprops and gtkmm-2.4d.vsprops should no longer be used. These are the same as the ones for MSVC++ 2005 (the vc80 ones) and are only provided for backwards compatability, so that MSVC can still find them for projects that are still using these.
To prevent random crashes with MSVC++ 2005 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 DLL" 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 in MSVC++ 2005. This seems to have been fixed in MSVC++ 2008 and MSVC++ 2010.
To work around a compiler bug in Visual Studio (https://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.
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 required to be able to execute built gtkmm applications.
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.
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.
This is mostly mentioned for completeness. When distributing your application, we suggest to redistribute the required gtkmm files with your application instead of running the gtkmm installer because this is less error-prone and more convenient to end users. See the section below for what files you need when redistributing gtkmm with your application.
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. 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.
When redistributing your application, use the DLLs from the redist/ directory in the gtkmm installation path, not from the bin/ directory. The redist/ ones are stripped, which means debugging symbols have been removed, so that the files are smaller in size. Also, they have been compiled with "-O2", which means they are optimized for speed. The DLLs in bin/ are built with "-O0 -g" which is required for debugging. Debugging optimizated code often confuses gdb. When you use MSVC++ instead of MinGW, then the MSVC++ gtkmm DLLs are in bin/ instead of redist/. This is because it is common to execute both Debug and Release versions from the IDE, so all the DLLs need to be in the PATH.
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.
You will need all these files for gtkmm:
bin\libgtkmm-2.4-1.dll, bin\gtkmm-vc80-2_4.dll, bin\gtkmm-vc90-2_4.dll or bin\gtkmm-vc100-2_4.dll (depending on whether you built your application with MinGW, MSVC++ 2005, MSVC++ 2008 or MSVC++ 2010.)
bin\libgdkmm-2.4-1.dll, bin\gdkmm-vc80-2_4.dll, bin\gdkmm-vc90-2_4.dll or bin\gdkmm-vc100-2_4.dll
bin\libpangomm-1.4-1.dll, bin\pangomm-vc80-1_4.dll, bin\pangomm-vc90-1_4.dll or bin\pangomm-vc100-1_4.dll
bin\libatkmm-1.6-1.dll, bin\atkmm-vc80-1_6.dll, bin\atkmm-vc90-1_6.dll or bin\atkmm-vc100-1_6.dll
bin\libcairomm-1.0-1.dll, bin\cairomm-vc80-1_0.dll, bin\cairomm-vc90-1_0.dll or bin\cairomm-vc100-1_0.dll
bin\libgiomm-2.4-1.dll, bin\giomm-vc80-2_4.dll, bin\giomm-vc90-2_4.dll or bin\giomm-vc100-2_4.dll
bin\libglibmm-2.4-1.dll, bin\glibmm-vc80-2_4.dll, bin\glibmm-vc90-2_4.dll, or bin\glibmm-vc100-2_4.dll
bin\libsigc-2.0-0.dll, bin\sigc-vc80-2_0.dll, bin\sigc-vc90-2_0.dll, bin\sigc-vc100-2_0.dll
This is required by gtkmm, so you will need all of these, too. A more detailed explanation of what all these libraries provide is available at the GTK+ for Windows page.
bin\intl.dll (32 bit) or bin\libintl-8.dll (64 bit)
bin\freetype6.dll (32 bit) or bin\libfreetype-6.dll (64 bit)
bin\libgcc_s_sjlj-1.dll (only when using the MinGW gtkmm DLLs)
etc\pango\pango.modules: List of registered pango modules.
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.
If your program uses libxml++ then you will additionally need:
bin\libxml++-2.6-1.dll, bin\xml++-vc80-2_6.dll, bin\xml++-vc90-2_6.dll or bin\xml++-vc100-2_6.dll
If your program uses libglademm, then you will additionally need:
bin\libglademm-2.4-1.dll, bin\glademm-vc80-2_4.dll, bin\glademm-vc90-2_4.dll or bin\glademm-vc100-2_4.dll
To rebuild the gtkmm binaries or to recreate the installer, see the Building gtkmm on Windows.