GTK 2 gtk_widget_add_accelerator error: ‘GDK_Z’ undeclared
GTK 2 gtk_widget_add_accelerator error: ‘GDK_Z’ undeclared
我正在尝试为 GTK 菜单项分配加速器:
group = gtk_accel_group_new();
item = gtk_image_menu_item_new_from_stock(GTK_STOCK_UNDO, group);
gtk_widget_add_accelerator(item, "activate", group, GDK_Z, GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE);
但是当我编译时出现以下错误:
./src/main.c:171:55: error: ‘GDK_Z’ undeclared (first use in this function)
gtk_widget_add_accelerator(item, "activate", group, GDK_Z, GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE);
^
这是 pkg-config --cflags gtk+-2.0
的输出:
-pthread -I/usr/include/gtk-2.0 -I/usr/lib/x86_64-linux-gnu/gtk-2.0/include -I/usr/include/gio-unix-2.0/ -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/libpng12 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/libpng12 -I/usr/include/pango-1.0 -I/usr/include/harfbuzz -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/freetype2
如何使 GDK_Z
标识符可用于我的程序?
你没有包含 gdkkeysyms.h
:
#include <gdk/gdkkeysyms.h>
其中包含您的程序所需的 GDK_Z
。
我正在尝试为 GTK 菜单项分配加速器:
group = gtk_accel_group_new();
item = gtk_image_menu_item_new_from_stock(GTK_STOCK_UNDO, group);
gtk_widget_add_accelerator(item, "activate", group, GDK_Z, GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE);
但是当我编译时出现以下错误:
./src/main.c:171:55: error: ‘GDK_Z’ undeclared (first use in this function)
gtk_widget_add_accelerator(item, "activate", group, GDK_Z, GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE);
^
这是 pkg-config --cflags gtk+-2.0
的输出:
-pthread -I/usr/include/gtk-2.0 -I/usr/lib/x86_64-linux-gnu/gtk-2.0/include -I/usr/include/gio-unix-2.0/ -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/libpng12 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/libpng12 -I/usr/include/pango-1.0 -I/usr/include/harfbuzz -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/freetype2
如何使 GDK_Z
标识符可用于我的程序?
你没有包含 gdkkeysyms.h
:
#include <gdk/gdkkeysyms.h>
其中包含您的程序所需的 GDK_Z
。