We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 3557 - [WinRT, forcing #define _WIN32_WINNT 0x501, Fix] sdl_xinput.c(59): error C2065: 'XInputGetBatteryInformation': undeclared identifier
Summary: [WinRT, forcing #define _WIN32_WINNT 0x501, Fix] sdl_xinput.c(59): error C20...
Status: RESOLVED WONTFIX
Alias: None
Product: SDL
Classification: Unclassified
Component: *don't know* (show other bugs)
Version: 2.0.5
Hardware: x86 Windows 10
: P2 normal
Assignee: Ryan C. Gordon
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-01-11 15:27 UTC by Eugene Golushkov
Modified: 2017-01-13 19:29 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Eugene Golushkov 2017-01-11 15:27:18 UTC
sdl_xinput.c(59): error C2065: 'XInputGetBatteryInformation': undeclared identifier

XInputGetBatteryInformation is available since _WIN32_WINNT_WIN8, i.e. always in WinRT mode, but nevertheless, compilation error caused by forcing _WIN32_WINNT to 0x501 in public header.

I propose conservative fix here, but the whole idea of forcing _WIN32_WINNT to any fixed value, in public header, without the ability to override it - is quite interesting.

diff --git a/src/core/windows/SDL_windows.h b/src/core/windows/SDL_windows.h
--- a/src/core/windows/SDL_windows.h
+++ b/src/core/windows/SDL_windows.h
@@ -30,9 +30,11 @@
 #ifndef UNICODE
 #define UNICODE 1
 #endif
+#if !defined(__WINRT__)
 #undef _WIN32_WINNT
 #define _WIN32_WINNT  0x501   /* Need 0x410 for AlphaBlend() and 0x500 for EnumDisplayDevices(), 0x501 for raw input */
 #endif
+#endif
 
 #include <windows.h>
Comment 1 Eugene Golushkov 2017-01-11 15:44:27 UTC
This problem was caused by defining __WIN32__ in WinRT mode as an attempt to fix Bug #3556 in v2.0.4, but such definition causes much more problems then solves.

So, while rant about redefining _WIN32_WINNT in public header is still valid - but I am unaffected while __WIN32__ is not defined.
Comment 2 Sam Lantinga 2017-01-13 19:29:08 UTC
FYI, SDL_windows.h isn't a public header - it's just used internally building SDL.