This is a very simple question but I have been searching for a while now and have no luck. Im supposed to add it to the linker I beleive? Which is Project Properties > Linker > Input > Additional Dependencies. Im just confused on exactly what to do. Thank you.
-
One easy solution is to use `#pragma comment(lib, "d3dx9")` directly in the source code file. https://learn.microsoft.com/en-us/cpp/preprocessor/comment-c-cpp?view=msvc-160 – Simon Mourier Feb 17 '21 at 07:36
-
Be aware that ``d3dx9.lib`` along with the entire DirectX SDK is deprecated. See [Microsoft Docs](https://learn.microsoft.com/en-us/windows/win32/directx-sdk--august-2009-) and [this blog post](https://aka.ms/dxsdk). – Chuck Walbourn Feb 17 '21 at 08:00
1 Answers
The simplest solution is to add the Microsoft.DXSDK.D3DX NuGet package to your project and not use the legacy DirectX SDK at all. This puts the headers d3dx9*.h
, d3dx10*.h
, and d3dx11*.h
into your include path. It also adds d3dx9.lib
, d3dx10.lib
, and d3dx11.lib
to your link settings, and provides the required runtime DLLs 'side-by-side'. See this blog post.
Otherwise, to integrate the legacy DirectX SDK requires some special include/lib path ordering in VC++ Directories, and you'll have a number of other quirks to contend with. See Microsoft Docs for the details.
Of course, the real question is "Why are you using legacy Direct3D 9 in the first place instead of Direct3D 11?". For Direct3D 11 or Direct3D 12, you should avoid the legacy DirectX SDK and D3DX9/D3DX10/D3DX11 entirely. See Living without D3DX.

- 38,259
- 2
- 58
- 81