Helixirr
Helixirr

Reputation: 931

C++ - WINAPI - Raw input specific functions and structures missing?

While trying to use raw input specific functions and structures in WINAPI using MinGW in Code::Blocks IDE, I got lots of compiler errors for missing functions and structures:

> ||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) ===|

Why does this happen and how can this be fixed?

Upvotes: 0

Views: 556

Answers (2)

doctorlove
doctorlove

Reputation: 19232

It happens because

'RAWINPUTDEVICELIST' was not declared in this scope

etc.

The docs say to #include <Windows.h>

Upvotes: 0

Helixirr
Helixirr

Reputation: 931

Compiler errors occur because of missing preprocessor definition. Based on these general questions and answers found here, this piece of code will fix it:

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

Upvotes: 1

Related Questions