0

在尝试使用 Code::Blocks IDE 中的 MinGW 在 WINAPI 中使用原始输入特定函数和结构时,由于缺少函数和结构,我遇到了很多编译器错误:

> ||In function 'void find_devices_input()':| |16|error:
> 'RAWINPUTDEVICELIST' was not declared in this scope| |16|error:
> 'GetRawInputDeviceList' was not declared in this scope| |19|error:
> 'list_devices_input' was not declared in this scope| |19|error:
> expected type-specifier before 'RAWINPUTDEVICELIST'| |19|error:
> expected ';' before 'RAWINPUTDEVICELIST'| |25|error: type '<type
> error>' argument given to 'delete', expected pointer| ||=== Build
> finished: 6 errors, 0 warnings (0 minutes, 0 seconds) ===|

为什么会发生这种情况,如何解决?

4

2 回答 2

1

由于缺少预处理器定义而发生编译器错误。根据此处找到的这些一般问题和答案,这段代码将修复它:

#ifdef __MINGW32__
#   define _WIN32_WINNT 0x0501
#endif // __MINGW32__
#include <windows.h>
于 2013-07-03T12:27:03.213 回答
0

它发生是因为

'RAWINPUTDEVICELIST' 未在此范围内声明

等等

文档说_#include <Windows.h>

于 2013-07-03T12:33:54.817 回答