user360907
user360907

Reputation:

pkgconfig option for gtk-2.0

GCC is returning the following error

/usr/include/gtk-2.0/gtk/gtk.h:32:21: fatal error: gdk/gdk.h: No such file or directory

Using find /usr -name 'gdk.h' I was able to locate the missing header in

/usr/include/gtk-2.0/gdk/gdk.h

I'm guessing the error is arising form the fact that the compiler isn't looking in gtk-2.0 for the gdk directory, though I could be mistaken about that. If I am correct, what is the pkgconfig option for gtk-2.0, and if I'm wrong, what is it I'm really doing wrong?

Upvotes: 0

Views: 9151

Answers (3)

obendadk
obendadk

Reputation: 1

The trick $(pkg-config gtk+-2.0 --cflags) $(pkg-config gtk+-2.0 --libs) solved my problem. I wonder why gtk/gtk.h had is not in the gtk dir. kind of redirection confusions.

Upvotes: 0

eMPee584
eMPee584

Reputation: 2054

For me (on Debian) it was a different problem:

checking GTK_CFLAGS... Package libpng12 was not found in the pkg-config search path. Perhaps you should add the directory containing `libpng12.pc' to the PKG_CONFIG_PATH environment variable Package 'libpng12', required by 'GdkPixbuf', not found

Then I remembered this X11-startup-fail problem I was having the week before, right after upgrading libpng to latest experimental - which I had fixed by manually restoring previous version's .so files.. I forgot the pkgconfig files though. So this build problem fixed by properly "downgrading libpng12-0:i386 from 1.5.11-1 to 1.2.49-1." Bottom line: look at the configure output above the actual error. And don't install experimental libpng, chances are high it'll brick your GUI completly ;)

Upvotes: 1

ShinTakezou
ShinTakezou

Reputation: 9671

pkg-config gtk+-2.0 --libs
pkg-config gtk+-2.0 --cflags

the first gives the option to link the libs, the second the paths; I usually use something like

gcc $(pkg-config gtk+-2.0 --cflags) $(pkg-config gtk+-2.0 --libs) project.c -o project

of course when I want to compile "on the fly". Otherwise, you should use a semiautomatic way of doing this (configure script, Makefiles and so on)

Upvotes: 8

Related Questions