ozoromo
ozoromo

Reputation: 23

Adding directx to include and library directories throws over 300 errors

Im trying to work with direct x 9 / 10 right now but as soon as I add

C:\Program Files %28x86%29\Microsoft DirectX SDK %28November 2008%29\Include

to my include directory and

C:\Program Files %28x86%29\Microsoft DirectX SDK %28November 2008%29\Lib\x86 

to my library directories

I get 397 errors mostly consisting of

identifier "__RPC__inout_xcount" is undefined

and

expected a ')'  solution    C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\um\OAIdl.h  5621    

I don't understand what's causing all these errors in dlls I never touched which is located in a folder which I haven't seen before. Any help is appreciated

Upvotes: 0

Views: 622

Answers (1)

Chuck Walbourn
Chuck Walbourn

Reputation: 41127

The basic issue is that you have to reverse the include/lib path search order to use the legacy DirectX SDK in combination with the Windows 10 SDK.

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

Alternatively, you need to use the v14?_xp Platform Toolset which uses the Windows 7.1A SDK instead.

The legacy DirectX SDK was designed to work with the Windows 7 SDK or earlier that came with VS 2010, and the DirectX SDK is now deprecated.

See Microsoft Docs and this blog post.

A better option is to not use the legacy DirectX SDK at all, which means using DirectX 11 instead of the older DX9/DX10 APIs. See Living without D3DX.

There are also various StackOverflow threads that are all the same basic issue:

Be sure to read Where is the DirectX SDK (2021 Edition)?

Upvotes: 1

Related Questions