C ++ - WINAPI - 缺少原始输入特定的函数和结构?

时间:2013-07-03 12:27:03

标签: c++ winapi input user-input

尝试在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) ===|

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

2 个答案:

答案 0 :(得分:1)

由于缺少预处理器定义而发生编译器错误。基于这些一般问题和答案[{3}},这段代码将解决它:

#ifdef __MINGW32__
#   define _WIN32_WINNT 0x0501
#endif // __MINGW32__
#include <windows.h>

答案 1 :(得分:0)

这是因为

  

'RAWINPUTDEVICELIST'未在此范围内声明

docs#include <Windows.h>