Clash between ncurses.h and Windows headers
Doug Evans
dje@google.com
Sun Apr 29 18:38:00 GMT 2012
On Sat, Apr 28, 2012 at 7:54 AM, Eli Zaretskii <eliz@gnu.org> wrote:
> Like the problem with PDCurses reported here:
>
> http://sourceware.org/ml/gdb-patches/2012-01/msg00298.html
>
> I bumped into a similar problem with ncurses on MS-Windows: both the
> Windows API headers and ncurses.h define KEY_EVENT. Can we solve this
> in the same way we solved the previous one? Here's a patch I propose:
>
> 2012-04-28 Eli Zaretskii <eliz@gnu.org>
>
> * gdb_curses.h: Undefine KEY_EVENT before including curses
> headers. Move "#undef MOUSE_MOVED" before any curses header
> inclusion.
>
>
> --- gdb/gdb_curses.h~0 2012-01-13 13:17:56.000000000 +0200
> +++ gdb/gdb_curses.h 2012-04-28 17:05:32.126750000 +0300
> @@ -20,13 +20,6 @@
> #ifndef GDB_CURSES_H
> #define GDB_CURSES_H 1
>
> -#if defined (HAVE_NCURSES_NCURSES_H)
> -#include <ncurses/ncurses.h>
> -#elif defined (HAVE_NCURSES_H)
> -#include <ncurses.h>
> -#elif defined (HAVE_CURSESX_H)
> -#include <cursesX.h>
> -#elif defined (HAVE_CURSES_H)
> #ifdef __MINGW32__
> /* Windows API headers, included e.g. by serial.h, define MOUSE_MOVED,
> and so does PDCurses's curses.h, but for an entirely different
> @@ -34,7 +27,18 @@
> anywhere, avoid compiler warnings by undefining MOUSE_MOVED before
> including curses.h. */
> #undef MOUSE_MOVED
> +/* Likewise, KEY_EVENT is defined by ncurses.h, but also by Windows
> + API headers. */
> +#undef KEY_EVENT
> #endif
> +
> +#if defined (HAVE_NCURSES_NCURSES_H)
> +#include <ncurses/ncurses.h>
> +#elif defined (HAVE_NCURSES_H)
> +#include <ncurses.h>
> +#elif defined (HAVE_CURSESX_H)
> +#include <cursesX.h>
> +#elif defined (HAVE_CURSES_H)
> #include <curses.h>
> #endif
>
Ok by me.
More information about the Gdb-patches
mailing list