Frage

I have a gtk program in which I am calling a gdk function. I am compiling the program using:

 gcc `pkg-config --cflags --libs gtk+-2.0 cairo glib-2.0` ...

and I have included

#include <gdk/gdk.h>

it gives me the error:

undefined reference to `gdk_device_ungrab'

Does anyone know what I am doing wrong?

War es hilfreich?

Lösung

You are compiling and linking against gtk 2.x and gdk_device_ungrab is available only starting from gtk 3.0.

See: http://developer.gnome.org/gdk3/3.4/GdkDevice.html#gdk-device-ungrab

Andere Tipps

You have to put your source or object files before the libraries in the command line, i.e. at the beginning, before the pkg-config part.

The linker adds objects and libraries in the order they are specified in the command line; if the gdk library is listed before your source file, the linker doesn't know your code needs the libray until it is too late.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top