GTK+ FAQ
<<< Previous | How to find, configure, install, and troubleshoot GTK+ | Next >>>

# I've compiled and installed GTK+, but I can't get any programs to link with it!

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'. There are two things you need to check:

- 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 directory GTK is in using

  `gtk-config --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`

- Make sure the linker is finding the correct set of libraries. If you have a Linux distribution that installs GTK+ (e.g. RedHat 5.0) then this older version may be used. Now (assuming you have a RedHat system), issue the command

  `rpm -e gtk gtk-devel`

  You may also want to remove the packages that depend on gtk (rpm will tell you which ones they are). If you don't have a RedHat Linux system, check to make sure that neither `/usr/lib` or `/usr/local/lib` contain any of the libraries libgtk, libgdk, libglib, or libgck. If they do exist, remove them (and any gtk include files, such as `/usr/include/gtk` and `/usr/include/gdk`) and reinstall gtk+.

<<< Previous | Home | Next >>>
When compiling GTK+ I get an error like: `make: file `Makefile' line 456: Syntax error` | Up | When compiling programs with GTK+, I get compiler error messages about not being able to find `glibconfig.h`.