Using GTK+ in Visual C++

I have gotten the Hello World Tutorial explained here: http://developer.gnome.org/gtk-tutorial/stable/c39.html#SEC-HELLOWORLD to work with Visual C++ 10 in Windows 7 32-bit. Here are the steps I went through (assuming you installed GTK+ to C:\GTK+):

Go to Properties/Configuration Properties/Debugging and add this to the Environment

PATH=%PATH%;C:\GTK+\bin

Go to Properties/Configuration Properties/C/C++/General and add to Additional Include Directories(I'm sure there's a better way to do this but it works):

C:\GTK+\include\gtk-2.0;C:\GTK+\include\glib-2.0;C:\GTK+\lib\glib-2.0\include;C:\GTK+\include\cairo;C:\GTK+\include\pango-1.0;C:\GTK+\include\gtk-2.0\gdk;C:\GTK+\lib\gtk-2.0\include;C:\GTK+\include\gdk-pixbuf-2.0;C:\GTK+\include\atk-1.0

Properties/Configuration Properties/Linker/General and add to Additional Library Dependencies:

C:\GTK+\lib

Finally Properties/Configuration Properties/Linker/Input:

gtk-win32-2.0.lib;gdk-win32-2.0.lib;atk-1.0.lib;gdk_pixbuf-2.0.lib;pangowin32-1.0.lib;pangocairo-1.0.lib;pango-1.0.lib;cairo.lib;gthread-2.0.lib;gobject-2.0.lib;gmodule-2.0.lib;glib-2.0.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)

This worked for the Hello World tutorial, but I have a feeling if you use more commands, there may be some libs/headers I left out. This should provide a good foundation though for anyone programming with GTK+ in Visual C++


For any kind of library, first you need to make sure you have the available lib files and associated headers. After you have those, you simply modify your projects properties under the C++ > General > Additional Include directories, to contain the path to the headers, and under the Linker > General > Additional Library Dependencies, to contain the path to your lib files. Then under Linker > Input > Additional Dependencies, you add the file name (not the full path) of the .lib files you need.


There are some old instructions here and here. You will probably have to adjust them for your needs.

GTK also has some email lists you could join to discuss this. The best lists for this particular question are [email protected] or [email protected].

There's also an irc channel, #gtk+ on irc.gnome.org. My experience there is you get either quick answers or no answers at all.

If you can, you might try switching from Visual C++ to mingw, which is a Unix/Linux like build system for Windows. Very few GTK developers use it on Windows, and almost all of those people use mingw.