Why gcc can't find the right version of Gtk and Gdk?

2.1k views Asked by At

Hello I'm using Ubuntu 11.10. I tried to compile a simple Gtk example in eclipse... The result is that it says gtk is missing. I looked in usr/include and there is both gtk-2.0 and gtk-3.0. So in the include I wrote

#include <gtk-3.0/gtk/gtk.h>

but now it complains that it can't find gdk.h.... it is the gtk-3.0 tree! why it can't find it? I even tried to symlink gtk to gtk-3.0 dir with no result...

1

There are 1 answers

0
nos On

#include <gtk-3.0/gtk/gtk.h> should just be #include <gtk/gtk.h>

Then, you're supposed to use the output of the command:

 pkg-config gtk+-3.0 --cflags

As the compiler flags when you compile your program, and

 pkg-config gtk+-3.0 --libs

When you link your program.

See the "Compiling GTK+ Applications" in the GTK documentation