0

我在带有 Visual Studio 2017 的 Windows 中使用 PDCurses。该库是使用 MSVC 编译器编译的,我根据README制作了 win32a 版本。我做了一些测试,并能够将库链接到一些小型测试程序。

然后我尝试测试这个howto中找到的示例如何使用鼠标,但Visual Studio告诉我该getmouse函数没有接收任何参数(它应该接收一个MEVENT*参数)。Intellisense 将我指向声明

unsigned long getmouse(void);

看着curses.h我发现了一点

#ifdef NCURSES_MOUSE_VERSION
# define getmouse(x) nc_getmouse(x)
#endif

nc_getmouse确实收到了正确的论点:

int     nc_getmouse(MEVENT *);

也许我在构建库时忘记设置一些选项?

有人可以在这里给我一个方向吗?这是我第一次使用这个库。

4

1 回答 1

0

好吧,您使用的是 ncurses 鼠标 API,而不是本机 PDCurses API。这很好,但如果你想这样做,你应该在包含 curses.h 之前#define NCURSES_MOUSE_VERSION。从 PDCurses 文档中:

nc_getmouse() returns the current mouse status in an MEVENT
struct. This is equivalent to ncurses' getmouse(), renamed to
avoid conflict with PDCurses' getmouse(). But if you define
NCURSES_MOUSE_VERSION (preferably as 2) before including
curses.h, it defines getmouse() to nc_getmouse(), along with a
few other redefintions needed for compatibility with ncurses
code. nc_getmouse() calls request_mouse_pos(), which (not
getmouse()) is the classic equivalent.
于 2018-01-03T04:38:34.100 回答