You can hit a number of issues when mixing the legacy DirectX SDK headers with the Windows 8.0 SDK, Windows 8.1 SDK, or the Windows 10 SDK. The problems are because the legacy DirectX SDK has some older headers that conflict with the new SDKs.
You likely need two fixes:
First, make sure that you add the DirectX SDK include and lib paths at the end of the search path rather than the beginning so you get the newer ones listed first.
For x86/Win32 configurations:
$(ExecutablePath);$(DXSDK_DIR)Utilities\bin\x86
$(IncludePath);$(DXSDK_DIR)Include
$(LibraryPath);$(DXSDK_DIR)Lib\x86
For x64 native configurations:
$(ExecutablePath);$(DXSDK_DIR)Utilities\bin\x64;$(DXSDK_DIR)Utilities\bin\x86
$(IncludePath);$(DXSDK_DIR)Include
$(LibraryPath);$(DXSDK_DIR)Lib\x64
Second, explicitly include the dependent header so you don't end up with the older one:
#include <windows.h>
#include <windowsx.h>
#include <d3d11.h>
#include <dxgi.h> // <-- make sure you pick up the Windows SDK version
#include <d3dx11.h> // and not from the DXSDK
If you let d3dx11.h
pull in dxgi.h
then you'll end up with the wrong one!
See MSDN, Where is the DirectX SDK (2015 Edition)?, and The Zombie DirectX SDK
Two other things to note here about your code. First, there's no reason at all to use DirectX 10 or d3dx10.h
. Use DirectX 11 only.
Second, D3DX itself is deprecated including D3DX9, D3DX10, and D3DX11. See Living without D3DX for Direct3D 11 open source replacements.