Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using GTK+ in Visual C++

I want to use GTK for user interface for C++ project. I do not know how to set development environment for it. I downloaded all-in-one bundle of gtk from http://www.gtk.org/download-windows.html How to use it with visual c++ 2008 ?

like image 928
Xinus Avatar asked Oct 03 '09 08:10

Xinus


1 Answers

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++

like image 114
Anthony Avatar answered Oct 19 '22 19:10

Anthony