So, first download Gtk+2.20 (or any newer at this moment) from www.gtk.org

Extract archive and put all content into, for example, gtk_2.20 folder and then put it to your root
 drive, like this: 

 

The very last folder is our gtk folder, it should have following content arranged like this:

 

Next thing, we have to configure Visual Studio environment.

 

 

Projects and Solutions --> VC++ Directories --> Show directories for: Include Files
Then add following paths by hitting “new line” button:

C:\gtk_2.20\include\atk-1.0
C:\gtk_2.20\lib\gtk-2.0\include
C:\gtk_2.20\include\pango-1.0
C:\gtk_2.20\include\cairo
C:\gtk_2.20\lib\glib-2.0\include
C:\gtk_2.20\include\glib-2.0
C:\gtk_2.20\include\gtk-2.0
C:\gtk_2.20\include

Next, Projects and Solutions --> VC++ Directories --> Show directories for: Library Files
Then add following paths by hitting “new line” button:


C:\gtk_2.20\lib

  Next, Project --> Properties 

 

 

Next, Configuration Properties --> C/C++ --> Code Generation --> RunTime Library: Multi-threaded (/MT)

Next, Configuration Properties --> Linker --> Input --> Additional Dependencies, and add here
references to Gtk libraries:


glib-2.0.lib gtk-win32-2.0.lib gdk-win32-2.0.lib gobject-2.0.lib gdk_pixbuf-2.0.lib gthread-2.0.lib
gmodule-2.0.lib pango-1.0.lib atk-1.0.lib zdll.lib

 

 

Next, Configuration Properties --> Linker --> System --> Subsystem: Windows (/SUBSYSTEM:WINDOWS)

 

Next, sample code:

 

#include <iostream>
#include <regex>
#include <windows.h>
#include <gtk/gtk.h>


using namespace std;
int main( int argc, char **argv );
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPSTR lpCmdLine,int nCmdShow){
return main (__argc, __argv);
}


int main( int argc, char **argv ) {
GtkWidget *window;
gtk_init( &argc, &argv );
window = gtk_window_new( GTK_WINDOW_TOPLEVEL );
g_signal_connect( G_OBJECT( window ), "destroy",
G_CALLBACK( gtk_main_quit ), NULL );
gtk_widget_show( window );
gtk_main ();
return 0;
}

Compiled and run without any errors or warnings – we have configured everything just fine and can
start with Gtk+ GUI development. Well, not many people writing code for windows using Gtk+ gui
library and there are just a couple of bigger projects using this lib (GIMP for example), mostely
projects that came from Unix systems. Well, personaly, its my choice, maybe because I came from
Unix to Windows with a couple of years of experience in GNOME / GTK development and it is
pretty much easy for me.


Why Gtk?
1. Its C based, not C++, therefore you can mix here C code, C++ code, win32 API, NT API,
anything you like.
2. Theming system is just great! You can easily create themes and make your app looking
better then apps written in C# for example.
3. You can rely on it – it is stable and only bad written code can crash application.


Machinized Fractals
www.machinized.com