Games for Windows and the DirectX SDK blog

Technical tips, tricks, and news about game development for Microsoft platforms including desktop, Xbox, and UWP


Project maintained by walbourn Hosted on GitHub Pages — Theme by mattgraham
Home | Posts by Tag | Posts by Month

Visual Studio 2012 Update 1

dxsdk, visualc

Originally posted to Chuck Walbourn's Blog on MSDN,

An update to Visual Studio 2012 is now available for download. For full details, see the following blog posts: Visual Studio team blog, Somasegar’s blog, and Visual Studio ALM + Team Foundation Server blog.

This update includes support for targeting Windows XP with the Visual C++ 2012 toolset and CRT. This provides C++11 Language and Standard Library support for Win32 desktop applications compatible with the legacy Windows XP platform. This is accomplished through using the Platform Toolset v110_xp. Details on this were announced for the CTP.

See KB 2797915

Compiler and CRT

VS 2012 Update 1 includes a new version of the compiler (17.00.51106) and C/C++ Runtime (11.0.51106).

MSDN downloads has the updated retail redistribution packages which are now compatible with Windows XP Service Pack 3.

Windows SDK and Windows XP

First be sure to read this blog post by the Visual Studio team. When building applications that support the legacy Windows XP platform, you are using a platform header and library set similar to those that shipped in the Windows 7.1 SDK rather than the Windows 8.x SDK with the integrated DirectX SDK content (see Where is the DirectX SDK?). Many of the “DirectX” headers and libraries are included with these Windows XP compatible platform headers (see DirectX SDKs of a certain age) such as Direct3D 9, DirectSound, and DirectInput. You will, however, need to continue to use the legacy DirectX SDK for Windows XP compatible versions of the D3DCompile API (#43), legacy D3DX9, XAUDIO2, XINPUT, and PIX for Windows tool (the Visual Studio 2012 Graphics Debugger does not support Direct3D 9 applications).

Windows SDK 7.1A is installed as part of VS 2012 Update 1 for use with the v110_xp Platform Toolset, which contains the headers, libraries, and a subset of the tools that originally shipped in the Windows SDK 7.1. There are older Direct3D 10 and Direct3D 11 headers as part of this 7.1 era toolset which are outdated compared to the Windows 8.x SDK versions using the standard v110 Platform Toolset, particularly the SDK Debug Layers installed by the Windows 8.0 SDK on Windows 7 and Windows 8. The Platform Toolset v110_xp is therefore not recommended for developing DirectX 11 applications, but it can technically be done with some caution. Windows SDK 7.1A does not contain a dxguid.lib so must either locally define the required GUIDs in your project by using #define INITGUID in one of your .cpp files, or use the legacy DirectX SDK version.

This also means that the ‘search path order’ guidance for v110_xp is different than the Windows 8.x SDK recommendations on Microsoft Docs. For v110_xp you should use the legacy order:

$(DXSDK_DIR)Include;$(IncludePath)
$(DXSDK_DIR)Lib\x86;$(LibraryPath)

For v110 if you are using legacy DirectX SDK components for an EXE that does not support Windows XP:

$(IncludePath);$(DXSDK_DIR)Include

$(LibraryPath);$(DXSDK_DIR)Lib\x86
or
$(LibraryPath);$(DXSDK_DIR)Lib\x64

_WIN32_WINNT: When building an application that is ‘down-level’ when using headers in the Windows 8.x SDK, be sure to explicitly select the correct ‘minimum’ _WIN32_WINNT value. For Windows 8, that is 0x0602 (which is the default when building code with Visual Studio 2012 and for all Windows Store apps). For Windows 7 use 0x0601, and for Windows Vista use 0x0600. When using v110_xp set it to 0x0502 (the Visual C++ REDIST requires Windows XP Service Pack 3). Typically this is done as part of the project configuration via Preprocessor Definitions. See Using the Windows Headers for more information.

Note: The Direct3D 9 Developer Runtime is only available on Windows 7 or older versions of the OS using the legacy DirectX SDK. Direct3D 9 debugging is not supported for Windows 8.x or Windows 10.

Windows Server: Targeting Window Server 2003 or Windows Server 2003 R2 also requires the use of v110_xp.

VS 2013: This information also applies to Visual C++ 2013’s v120_xp platform target.

VS 2015: This information also applies to Visual C++ 2015’s v140_xpplatform target. Note that a number of warnings are generated in system headers when using the older SDK with the newer compiler. You will need to select the optional component Windows XP Support for C++ in the custom install.

VS 2017: This information also applies to Visual C++ 2017’s v141_xp platform target. Note that a number of warnings are generated in system headers when using the older SDK with the newer compiler, and you won’t be able to make use of /permissive-.  You will need to install additional optional component Windows XP Support for C++ (Microsoft.VisualStudio.Component.WinXP and Microsoft.VisualStudio.ComponentGroup.NativeDesktop.WinXP) in the installer.

VS 2019: Visual C++ 2019 does not have a newer Platform Toolset for Windows XP. It continues to support the VS 2017 era v141_xp Platform Toolset if you install the Windows XP Support for VS 2017 (v141) tools component. See Microsoft Docs.

DirectXMath and Windows XP

DirectXMath in the Windows 8.x SDK is compatible with Windows XP, but the v110_xp Platform Toolset include paths will not find it. You can make use XNAMath 2.05 for your Windows XP configurations, or you can make a copy of the DirectXMath headers in the project for Windows XP configurations–DirectXMath can also obtained directly from GitHub.

Microsoft::WRL::ComPtr and Windows XP

A similar issue to the one with DirectXMath arises when using the ComPtr smart-pointer: the v110_xp Platform Toolset include paths will not find wrl.h or wrl\client.h. You can use ATL’s CComPtr instead when targeting Windows XP, but remember that operator& with ATL’s CComPtr maps to GetAddressOf() while the same operator with Microsoft::WRL::ComPtr maps to ReleaseAndGetAddressOf().

Code Analysis

This update includes Code Analysis /analyze support for Windows phone 8 applications (i.e. when using the Platform Toolset v110_wp80)

Note that the Platform Toolset v110_xp does not support Code Analysis /analyze which is disabled due to incompatibilities with the Windows SDK 7.1A headers.

Related: Visual Studio 2012 Update 2, Visual Studio 2012 Update 3, Visual Studio 2012 Update 4