HowTo use Dev-C++ to compile GTK+ applications

This procedure is well suited for Win32 only users. If you are a Unix/Linux/Posix aware user, probably you want to follow the HowTo for GTK+ with Cygwin, as you will find all the developer tools you are accustomed to use (state of the art powerfull editor, nm, file, grep, sources browser, ecc...).
The applications builded with this method do not depend on the Xserver, so run natively on Win32 GDI.

1 - Install Dev-C++ from: http://www.bloodshed.net/dev/ in C:\Program Files\Dev-Cpp directory.
2 - Install the GTK+-2.12 devpack from: http://gtk.alkia.org/index.php using Tools Menu, Package Manager.
3 - In Tools Menu, Compiler Options, Directories Tab, C Includes, add the following directories:
     C:\Program Files\Dev-Cpp\include\gtk-2.0
     C:\Program Files\Dev-Cpp\include\atk-1.0
     C:\Program Files\Dev-Cpp\include\cairo
     C:\Program Files\Dev-Cpp\include\pango-1.0
     C:\Program Files\Dev-Cpp\include\glib-2.0
     C:\Program Files\Dev-Cpp\lib\gtk-2.0\include
     C:\Program Files\Dev-Cpp\lib\glib-2.0\include
4 - In Compiler tab, mark "Add these commands when calling compiler".
5 - Fill the box with:
     -mms-bitfields
6 - In Compiler tab, mark "Add these commands to the linker command line".
7 - Fill the box with:
     -lgtk-win32-2.0 -lgdk-win32-2.0 -limm32 -lshell32 -lole32 -latk-1.0 -lgdk_pixbuf-2.0
     -lpangocairo-1.0 -lcairo -lpangoft2-1.0 -lpangowin32-1.0 -lgdi32 -lpango-1.0 -lm
     -lgobject-2.0 -lgmodule-2.0 -lglib-2.0 -lintl -lfreetype -lzdll -lfontconfig -lpng13
8 -
If you want to test your libraries installation and compiler configuration, you can download this minimal source, but use the Cairo and so the GTK+-2.8 or higher. If it compile, you can be sure that complex application compile as well.

Note: If you want to create the GUI with Glade2 like with VisualC, download the Glade2.12.1 installer and run it.
Create the windows, dialog boxes, set the properties, hook all the callbacks, and save the .glade file in a <project> directory. That file is an XML based format.
Then press the Build button, it create the source C code for you, in <project>\src directory.
It create the Dev-C++ .dev project file in <project>\devcpp directory. Now you can use this file inside Dev-C++ to continue the development of your project.
It also create the unix autotools chain (autogen, autoconf, automake) in <project> directory, and MS-VisualC project file in <project>\msvc directory.

Packaging:
----------
The builded executable can be packaged with NSIS, a professional Win32 opensource installer:
http://nsis.sourceforge.net/Main_Page
so the Win32 only users can easily install your application.
You have to package:
1 - the application executables
2 - the <Program main directory>\pixmaps directory (if used)
3 - the GTK+ Win32 runtime. Work with both the following runtime:
http://gtk-win.sourceforge.net/ (Gtk 2.14.4 Runtime installer. Size: 6.26 MB)
http://gladewin32.sourceforge.net/ (Gtk+ 2.12.9 Runtime Environment Revision 2. Size: 7.2 MB)
You can choose to keep the GTK+ runtime separately to keep the package size smaller.
For point 3, do not forget to link the sources web site, or better distribute the sources of that package, as the GNU GPL impose

Useful links on GTK+, Glade, Cairo, GUI crossplatform developing

Why use GTK+ v2.8+ and Cairo v1.4+ to develop GUI crossplatform applications

Go to EFA programming page

Back to home page:  EFA home page

Web site showed  times since 01/04/2000. 
From 20/10/1999 - 31/03/2000 the counter showed 770 visits, but it was resetted from the provider (so add 770 ...)

Copyright (C) 2006,2007,2008  Valerio Messina http://users.iol.it/efa
Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License,
Version 1.3 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts
and no Back-Cover Texts.  A copy of the license is included in the section entitled "GNU Free Documentation License" or
can be downloaded at: http://www.gnu.org/licenses/fdl.html