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 3385

Summary: As of Visual Studio 2015 U3 the macro _USING_V110_SDK71_ is no longer reliable
Product: SDL Reporter: Zsar <lordzsar1>
Component: buildAssignee: Sam Lantinga <slouken>
Status: RESOLVED WONTFIX QA Contact: Sam Lantinga <slouken>
Severity: minor    
Priority: P2 CC: chli.hug, icculus, philipp.wiesemann
Version: 2.0.4Keywords: target-2.0.6
Hardware: x86_64   
OS: Windows 7   
See Also: https://bugzilla.libsdl.org/show_bug.cgi?id=2451
https://bugzilla.libsdl.org/show_bug.cgi?id=2466
Attachments: Patch that adds a check for __has_include.

Description Zsar 2016-07-07 15:56:42 UTC
My project compiled fine before I updated to VS2015 U3. Now the issue raised in bugs 2451 and 2466 is present: The header file "winapifamily.h" is included in line 121 of file sdl_platform.h but not available in the vs140_xp toolset.

Before U3 the macro _USING_V110_SDK71_ ensured that the include would not be attempted, but now it is apparently no longer set. The configuration of my project has not changed between the last successful and the current build.

I am not sure whether this might not rather be a defect in VS2015 U3, but this is seemingly impossible to find out. In any case, a more robust check might be viable: http://stackoverflow.com/a/33260104/3434465

For now I can continue by defining the macro myself, so this is not a particularly critical issue. Feels bad not knowing whether the macro's removal might have been intentional, though.
Comment 1 Ryan C. Gordon 2017-08-18 20:47:14 UTC
Could we just check the _MSC_VER macro and not include this if we're on VS2015 or later?

(and is the header gone because this is just part of windows.h now or something?)

--ryan.
Comment 2 Sam Lantinga 2017-08-19 08:38:37 UTC
I installed Visual Studio 2015 and switched a project to use the 140_xp toolset, and it did automatically define _USING_V110_SDK71_ in my project settings.

I'm guessing this is a bug in the Visual Studio update process, where sometimes that doesn't get set? If you remove your own definition and then change the toolset to a few different values, does it get set again when you set it back to 140_xp?
Comment 3 Sam Lantinga 2017-08-19 10:15:52 UTC
This is partially fixed in this commit:
https://hg.libsdl.org/SDL/rev/3ed56acc90ca

This only works for Visual Studio 2017 and newer, unfortunately. Since you have a workaround and I don't see a way to fix this for Visual Studio 2015, I'm going to mark this bug as WONTFIX.
Comment 4 Simon Hug 2017-09-08 21:50:17 UTC
Created attachment 2916 [details]
Patch that adds a check for __has_include.

Sam, I think __has_include is only available with _MSC_VER>=1911.

The compiler version from the first Visual Studio 2017 (19.10.25017) doesn't have it.

I updated to the recently released 15.3 (19.11.25506) and there it is defined.

Can't say anything about 15.1 and 15.2.

An additional defined(__has_include) check can fix it.
Comment 5 Sam Lantinga 2017-09-08 22:10:04 UTC
Fixed, thanks!
https://hg.libsdl.org/SDL/rev/71610a71bbb2