miluuu
miluuu

Reputation: 29

Linker Error: Cannot open input file 'd3dx9.lib'

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.

Upvotes: 0

Views: 2231

Answers (1)

Chuck Walbourn
Chuck Walbourn

Reputation: 41047

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.

Upvotes: 1

Related Questions