Luke
Luke

Reputation: 21276

GTK 2 gtk_widget_add_accelerator error: ‘GDK_Z’ undeclared

I'm trying to assign an accelerator to a GTK menu item:

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);

But when I compile I get the following error:

./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);
                                                       ^

This is the output from 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

How can I make the GDK_Z identifier available to my program?

Upvotes: 1

Views: 290

Answers (1)

Michi
Michi

Reputation: 5307

You did not included gdkkeysyms.h:

#include <gdk/gdkkeysyms.h>

Which contains GDK_Z needed for your program.

Upvotes: 1

Related Questions