Using gdk-pixbuf



Hello, I just added the following function to a little gtk program
(compiling fine until I added the function):

void
take_screen_shot (void)
{
  gint width, height;
  GtkRequisition req;

  gtk_widget_size_request(layout, &req);

  width = req.width;
  height = req.height;
  
  screenshot = gdk_pixbuf_get_from_drawable (NULL,
                                            GTK_LAYOUT(layout)->bin_window,
					    NULL, 0, 0, 0, 0,
					    width, height);
}

the variables 'screenshot' and 'layout' are declared as globals as
follows:

GdkPixbuf *screenshot = NULL;
GtkWidget *layout;

I don't know if using a GtkRequisition to get a Widget's size is the best
option but it seems to work fine (is there any other way to get the size
of the layout in this example?), but that's not the problem. The real
problem is when I compile the file like this:

cc `gtk-config --cflags` `gtk-config --libs` pixmap.c -o pixmap
/tmp/cc0oRXe5.o: In function `take_screen_shot':
/tmp/cc0oRXe5.o(.text+0x304): undefined reference to 
`gdk_pixbuf_get_from_drawable'
collect2: ld returned 1 exit status
make: *** [pixmap] Error 1

Am I missing some flags or something? the include line for gdk-pixbuf is
in my source code (#include <gdk-pixbuf/gdk-pixbuf.h>) and the sample file
from where I took the code for this function doesn't seem to have any
special flags for gdk-pixbuff (just gnome and glade flags tough).

Thanks in advance,

Jose.





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]