Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/152.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ C++;-WINAPI-缺少原始输入特定的函数和结构?_C++_Winapi_Input_User Input - Fatal编程技术网

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

C++ C++;-WINAPI-缺少原始输入特定的函数和结构?,c++,winapi,input,user-input,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

在使用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) ===|
函数“void find_devices_input()”中的:| 16 |错误: >“RAWINPUTDEVICELIST”未在此范围内声明| | 16 |错误: >“GetRawInputDeviceList”未在此范围内声明| | 19 |错误: >“列表设备输入”未在此范围内声明| | 19 |错误: >“RAWINPUTDEVICELIST”之前的预期类型说明符| | 19 |错误: >期望“;”在“RAWINPUTDEVICELIST”之前| | 25 |错误:键入“error>”参数以指定给“delete”,预期指针| | |===生成 >已完成:6个错误,0个警告(0分0秒)===|
为什么会发生这种情况以及如何修复这种情况?

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

#ifdef __MINGW32__
#   define _WIN32_WINNT 0x0501
#endif // __MINGW32__
#include <windows.h>
\ifdef\uu MINGW32__
#定义_WIN32_WINNT 0x0501
#endif/\uu MINGW32__
#包括
发生这种情况是因为

未在此作用域中声明“RAWINPUTDEVICELIST”

等等


#include

的发言权对于Microsoft Visual Studio和其他IDE来说可能是这样的,但是对于代码块中的MinGW来说,这并不能很不幸地消除它。我相信MinGW的标题并没有他们应该的那么准确。我不是这方面的专家,只是想帮助那些和我有类似问题的人我建议改用,这样你就不用担心这样的事情了。