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 4450

Summary: SDL_mouse.c fails to compile with CMake generated Visual Studio files if SDL_VIDEO_VULKAN 0/undefined
Product: SDL Reporter: Max Waine <bobishmax>
Component: eventsAssignee: Sam Lantinga <slouken>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2 CC: marius.elvert
Version: 2.0.9   
Hardware: x86   
OS: Windows 10   

Description Max Waine 2019-01-10 16:43:57 UTC
SDL_mouse.c, if compiled for Windows, requires GetDoubleClickTime to compile (available from winuser.h). Without Vulkan present this fails to compile as the include chain for winuser.h is the following.

SDL_mouse.c -> SDL_sysvideo.h -> SDL_vulkan_internal.h -> SDL_windows.h -> windows.h -> winuser.h.
Problem is that SDL_vulkan_internal.h doesn't include SDL_windows.h if Vulkan isn't present, so under MinGW/GCC it will give a -Wimplicit-function-declaration warning for GetDoubleClickTime, and under MSVC fails to compile completely.

The solution to this would be to simplify the include chain: including SDL_windows.h under the same condition as GetDoubleClickTime (#ifdef __WIN32__) in SDL_mouse.c (or another file that isn't quite so indirectly included).
Comment 1 Max Waine 2019-01-10 17:18:37 UTC
Oh it's important to mention that both the files for MinGw and Visual Studio were generated with CMake.
Comment 2 Marius Elvert 2019-02-09 02:35:08 UTC
I do have the same problem although it did compile for me with warning C4013: 'GetDoubleClickTime' undefined; assuming extern returning int, leading me into a wild goose chase of what broke my build.
Comment 3 Sam Lantinga 2019-03-17 02:07:53 UTC
Fixed, thanks!
https://hg.libsdl.org/SDL/rev/d188272453ce