我正在使用 GTK+,由于某种原因,我的屏幕捕获功能无法编译并出现以下错误:
main.cpp:17:97:错误:“gdk_pixbuf_get_from_drawable”未在此范围内声明
gdk_pixbuf_get_from_drawable 在哪个 .H 文件中声明?下面是代码:
#include <libCrossLibs.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <gdk/gdk.h>
#include <gtk/gtk.h>
ILibraryInstance* inst;
GdkPixbuf* get_screenshot() {
GdkPixbuf* screenshot;
GdkWindow* rootWindow;
gint x_orig, y_orig;
rootWindow = gdk_get_default_root_window();
gint width, height;
width = gdk_window_get_width(rootWindow);
height = gdk_window_get_height(rootWindow);
gdk_window_get_origin(rootWindow,&x_orig,&y_orig);
screenshot = gdk_pixbuf_get_from_drawable(NULL, rootWindow,
NULL, x_orig, y_orig, 0, 0, width, height);
return screenshot;
}
int main(void) {
inst = InitializeLibraries();
}