0

If I attempt to use the function gdk_pixbuf_xlib_get_from_drawable, it results in the following linker error:

undefined reference to gdk_pixbuf_xlib_get_from_drawable

I am compiling it using the gtk+-2.0 and libwnck-1.0 pkg-config options, like this:

... `pkg-config gtk+-2.0 libwnck-1.0 --cflags --libs`

I have also tried adding gdk-2.0 and x11 to the pkg-config options, but it still did not work.

My code looks roughly like this:

wnck_window_get_geometry (window, &xp, &yp, &widthp, &heightp);
pixbuf = gdk_pixbuf_xlib_get_from_drawable (pixbuf, gdk_window,
    NULL, NULL, 0, 0, 0, 0, widthp, heightp);
adlo
  • 63
  • 8
  • what are you #including for the definition of that function? – Jussi Kukkonen Jun 11 '15 at 08:27
  • @jku At first, I just included `gtk.h` and `libwnck.h`. Then, I tried adding `gdk/gdk.h`, `gdk-pixbuf/gdk-pixbuf.h`, and `X11/Xlib.h` separately in turn. – adlo Jun 11 '15 at 21:10

1 Answers1

0

You need to add gdk-pixbuf-xlib-2.0 to your pkg-config checks, and include gdk-pixbuf-xlib.h.

Ross Burton
  • 3,516
  • 13
  • 12
  • This has solved my linker error, but when I run the program, it causes a segmentation fault. I have tried passing an XID instead of a GdkWindow, but it still segfaults. – adlo Jul 02 '15 at 21:57
  • You asked about the link error and that's resolved. Without stack traces, more code, and so on it's impossible to help more. – Ross Burton Jul 03 '15 at 22:36