听说DirectX11出了很多新特性，于是根据经验到网上去找SDK来体验，结果资源并不多，好不容易找到了，竟然安装失败，错误代码“S1023”于是到微软官网上找，好不容易找到了“DXSDK_Mar09”，下下来安装还是失败。于是反过头查S1023是何意。一查，竟是因为系统中存在更高版本的DirectX。嗯我这Win7以前可没专门装过DirectX11呀。于是又到官网上翻，终于看到了一篇“Where is the DirectX SDK?”。看完全文方知究竟。现将主要条款翻译如下：
Wherever "d3dx9.h", "d3dx10.h", or "d3dx11.h" are included in your project, be sure to explicitly include "d3d9.h", "d3d10.h" and "dxgi.h", or "d3d11.h" and "dxgi.h" first to ensure you are picking up the newer version. You can disable warning
C4005 if needed; however, this warning indicates you are using the older version of these headers.
Remove all references to DXGIType.h in your project. This header doesn't exist in the Windows SDK, and the DirectX SDK version conflicts with the new winerror.h.
All D3DX DLLs are installed onto your development computer by the DirectX SDK installation. Ensure that the necessary D3DX dependencies are redistributed with any sample or with your application if it is moved to another machine.
Ensure that you are using the new version of the HLSL shader compiler by observing the following conditions:
Changing the executable directory as per step 5 will cause project builds to use FXC from the Windows SDK install. Be aware that HLSL files are now officially recognized by Visual Studio. You can add them as project files and set compiler options through the
Invoking run-time compilation through the legacy D3DX DLL will use the incorrect older version of the HLSL compiler. Replace all references to D3DXCompile*, D3DX10Compile*, and D3DX11Compile* APIs in your code with the D3DCompile function in D3DCOMPILER_46.DLL
Any project that uses run-time shader compilation must have D3DCOMPILER_xx.DLL copied to the local executable path for the project. This DLL is available in this sub-directory of the Windows SDK installation under %ProgramFiles(x86)%\Windows
Kits\8.0\Redist\D3D\<arch> or %ProgramFiles(x86)%\Windows Kits\8.1\Redist\D3D\<arch> where <arch> is x86 and x64.
The D3DCOMPILER_46.DLL or D3DCOMPILER_47.DLL from the Windows SDK is not a system component and should not be copied to the Windows system directory. You can redistribute this DLL to other computers with your application as a side-by-side DLL.
Any project that uses the XInput API and is intended to run on Windows 7 or older versions of Windows need to use either the legacy version (9.1.0) or will need to explicitly include the headers and libraries for this component from the DirectX SDK. The XInput
header and XINPUT.LIB that are included in the Windows SDK target only the version (1.4) that ship as part of Windows 8 and later. The same header can be used with XINPUT9_1_0.LIB to use the legacy version, which is included with older versions of Windows.
The legacy version of XInput doesn't detect full capabilities or support controller-integrated audio, so if support for these features is required, you must use the DirectX SDK version (1.3).
To use the full-featured down-level XInput API, you should #include the specific XInput headers from the DirectX SDK directly:
...and in your linker options for Additional Dependencies, link directly to the DirectX SDK XInput library:
The XINPUT1_3.DLL binary is installed to the Windows system directories by the DirectX SDK installation on your development computer. You will need to redistribute this binary with your application using the DirectX Setup installation from the DirectX SDK.
Any project that uses the XAudio2 API and is intended to run on Windows 7 or older versions of Windows need to use either the older version (9.1.0) or explicitly include the headers and libraries for this component from the DirectX SDK. The XAudio2 headers
and libraries that are included with the Windows SDK target only the version (2.8) that is included as part of Windows 8.
For example, with XAudio2, you should #include the specific XAudio2 headers from the DirectX SDK directly:
...and in your linker options for Additional Dependencies, link directly to the DirectX SDK XAudio2 library:
The XAUDIO2_7.DLL binary is installed to the Windows system directories by the DirectX SDK installation on your development computer. You need to redistribute these libraries with your application using the DirectX Setup installation from the DirectX SDK.
If you’ve used the DirectX SDK with past versions of Visual Studio, the Visual Studio 2010 upgrade might have migrated the DirectX SDK path into your default project settings. It is recommended that you remove these settings to prevent future build errors.
In the%USERPROFILE%\AppData\Local\Microsoft\MSBuild\v4.0 directory, modify the Microsoft.Cpp.Win32.user and Microsoft.Cpp.x64.userfiles
to remove all references to DXSDK_DIR paths. Alternatively, you can remove the entire <PropertyGroup> node that contains the Path entries such as <ExecutablePath> and <IncludePath> to revert to standard defaults. If you don’t see references to DXSDK_DIR in
these files, no changes are necessary.
If the resulting app supports Windows Vista with Service Pack 2 (SP2) as well as Windows 7 and Windows 8 and later, set the Preprocessor Definition named _WIN32_WINNT to
0x600. If it only supports Windows 7 and Windows 8 and later, set it to 0x601.
Open Properties for the project and select C/C++ > Preprocessor.
Select All Configurations and All Platforms.
Go to the Preprocessor Definitions section and set _WIN32_WINNT=0x600.