DirectX libs in x64 program

1k views Asked by At

I'm trying to compile a program as 64 bits, it works perfectly with a simple console program but if I use my directX program it says me: error LNK1181: cannot open input file 'd3dx9.lib'. When I compile my directX program as 32 bits it works but in x64 it doesn't. I think visual studio 2013 has a default directory of directx with is x86 but I don't know if I'm right or not. I need to use x64 directX libs. How could I link them? Thanks for read.

1

There are 1 answers

0
Chuck Walbourn On

VS 2013 comes with the Windows 8.1 SDK, and as of the Windows 8.0 SDK the DirectX SDK is considered deprecated. All versions of D3DX (D3DX9, D3DX10, and D3DX11) are also deprecated and are only available with the legacy DirectX SDK. You can use the legacy DirectX SDK in combination with the Windows 8.x SDK, but it requires the reverse path setup of VS 2010 or earlier. See MSDN and this blog post.

In your case, you probably don't have your project's VC++ Directories properties set up correctly for the x64 configurations:

Executable path:

  • Win32 configs: $(ExecutablePath);$(DXSDK_DIR)Utilities\bin\x86
  • x64 configs: $(ExecutablePath);$(DXSDK_DIR)Utilities\bin\x64;$(DXSDK_DIR)Utilities\bin\x86

Include path

  • Both configs: $(IncludePath);$(DXSDK_DIR)Include

Library path

  • Win32 configs: $(LibraryPath);$(DXSDK_DIR)Lib\x86
  • x64 configs: $(LibraryPath);$(DXSDK_DIR)Lib\x64

Note: If you were using the v120_xp Platform Toolset for Windows XP support, you'd actually be using the Windows 7.1A SDK, and would go with the same path order as VS 2010 which is the reverse of the ones shown here--i.e. the DirectX SDK paths would go first, then the standard paths. See this post if you are trying to target Windows XP.

This all said, unless you are specifically targeting Windows XP the recommendation is to (a) use Direct3D 11 instead of legacy Direct3D 9, (b) avoid using the legacy DirectX SDK at all, and (c) avoid using D3DX9/D3DX10/D3DX11.

See also: