This problem is most often encountered when the GTK+ libraries can't be found or are the wrong version. Generally, the compiler will complain about an 'unresolved symbol'.
Make sure that the libraries can be found. You want to edit /etc/ld.so.conf to include the directories which contain the GTK libraries, so it looks something like:
/usr/X11R6/lib
/usr/local/lib
Then you need to run /sbin/ldconfig as root. You can find what libraries GTK requires using
pkg-config gtk+-2.0 --libs
If your system doesn't use ld.so to find libraries (such as Solaris), then you will have to use the LD_LIBRARY_PATH environment variable (or compile the path into your program, which I'm not going to cover here). So, with a Bourne type shell you can do (if your GTK libraries are in /usr/local/lib):
export LD_LIBRARY_PATH=/usr/local/lib
and in a csh, you can do:
setenv LD_LIBRARY_PATH /usr/local/lib