0x400921FB54442D18
0x400921FB54442D18

Reputation: 735

VS 2017 won't find DirectX include files

I have installed the DirectX SDK and I want to use in my C++ project in Visual Studio 2017. I configured the C++ include path and added a directory with the DirectX SDK include files ($(DXSDK_DIR)Include\) which resolves correctly to C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\Include\ where all the files are located

But when I try to #include <d3dx9core.h> which, as I checked myself, is correctly installed in the Include directory, it says it can't find the file.

How do I fix this?

Upvotes: 3

Views: 15656

Answers (1)

Chuck Walbourn
Chuck Walbourn

Reputation: 41127

To use the legacy DirectX SDK with VS 2010 or later, you have to manually add references to the include/lib paths. This is typically done by editing the VC++ Directories settings for your project putting the DirectX SDK folders first.

To use the legacy DirectX SDK with VS 2012 or later, you need use the reverse the path order--list the DirectX SDK folders after the standard ones--because Windows 8.x / Windows 10 SDK contains newer headers than the legacy DirectX SDK. Of course, there's no newer version of the D3DX9 headers.

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

There are also a few known issues when doing this that are addressed on Microsoft Docs. For example, you should explicitly include d3d9.h before you include d3dx9.h because otherwise you'll end up with the older d3d9.h header.

BTW, the dxerr.lib static libraries are not compatible with the VS 2015/VS 2017 C/C++ Runtime. Where’s DXERR.LIB?

One last gotcha: Direct3D 9 Debug Device is not supported on Windows 8.x or Windows 10.

Be sure to see Where is the DirectX SDK, Not So DirectSetup, and DXSETUP Update

You should also review Living without D3DX, DirectX SDK Tools Catalog, DirectX SDK Samples Catalog and The Zombie DirectX SDK

Upvotes: 9

Related Questions