Firstly try download archive with the version necessary to you from here:
http://www.gtk.org/download/linux.php
We unpack downloaded archive: "tar -xzvf gtk+-2.20.1.tar.gz"
We go to the unpacked folder: "cd gtk +-2.20.1"
We check a source in our system: "./configure"
If gives out that somethings don't suffice, we put a package: ibgtk2.0-dev: sudo apt-get install libgtk2.0-dev
We try again ". / configure" command
If again it inform that didn't find the necessary packages then try put them manually...
For example, if exist the following message : "No package 'glib-2.0' found No package 'atk' found No package 'pango' found No package 'cairo' found No package 'cairo-gobject' found No package 'gdk-pixbuf-2.0' found"
For example we need a glib-2.0 then we write: sudo apt-get install libglib2.0-dev (real estate development package, that is the development package), if that is necessary a dev package will pull for itself and other necessary packages.
Further, when ". / configure" doesn't swear any more, we write: " make"
After the "make" command, please write: "sudo make install"
Also,". / configure" can issue the following:
"configure: error:
*** Checks for TIFF loader failed. You can build without it by passing
*** --without-libtiff to configure but some programs using GTK+ may
*** not work properly"
Then you need to run "configure" with parameter: "./configure --without-libtiff"
Now we are trying to compile small simple example:
#include <gtk/gtk.h>
void
hello (void)
{
g_print ("Hello World\n");
}
void
destroy (void)
{
gtk_main_quit ();
}
int
main (int argc, char *argv[])
{
GtkWidget *window;
GtkWidget *button;
gtk_init (&argc, &argv);
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_signal_connect (GTK_OBJECT (window), "destroy",
GTK_SIGNAL_FUNC (destroy), NULL);
gtk_container_border_width (GTK_CONTAINER (window), 50);
button = gtk_button_new_with_label ("Hello World");
gtk_signal_connect (GTK_OBJECT (button), "clicked",
GTK_SIGNAL_FUNC (hello), NULL);
gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
GTK_SIGNAL_FUNC (gtk_widget_destroy),
GTK_OBJECT (window));
gtk_container_add (GTK_CONTAINER (window), button);
gtk_widget_show (button);
gtk_widget_show (window);
gtk_main ();
return 0;
}
Compile as follows:
gcc -o gtk_program `pkg-config --cflags --libs gtk+-2.0` gtk.c
Good luck.
Alex.