无法打开源文件 d3dx9.h
Cannot open source file d3dx9.h
在我开始之前,我知道这是一个很常见的问题,在 post 来到这里之前我确实搜索了答案。不幸的是,我没有运气。
在我的代码中,我包含了这样的文件:
#include <d3dx9.h>
现在出现错误:无法打开源文件d3dx9.h
在我的包含目录中,我确实输入了它所在的路径(如果我通过我的文件手动查找它,我可以在那里看到它)。
路径为:C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\Include
我还设置了图书馆目录:C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\Lib\x64
x64 因为我是 运行 64 位系统。
如果有人能花时间 post 提出建议,我将不胜感激。
你好。
Visual Studio 2015 包含 Windows 8.1 SDK,它比旧版 DirectX SDK 中的 headers 更新。 Windows 8.1 SDK 包括所有 DirectX headers 和库,但 不 包含现已弃用的 D3DX(D3DX9、D3DX10、D3DX11)实用程序库,这就是为什么它是 "missing".
D3DX9、D3DX10 和 D3DX11 仅在旧版 DirectX SDK 中可用。对于 VS 2010,您应该使用的 VC++ 目录设置对于 Win32 (x86) 设置如下:
<ExecutablePath>$(DXSDK_DIR)Utilities\bin\x86;$(ExecutablePath)</ExecutablePath>
<IncludePath>$(DXSDK_DIR)Include;$(IncludePath)</IncludePath>
<LibraryPath>$(DXSDK_DIR)Lib\x86;$(LibraryPath)</LibraryPath>
这对于 x64 本机:
<ExecutablePath>$(DXSDK_DIR)Utilities\bin\x64;$(DXSDK_DIR)Utilities\bin\x86;$(ExecutablePath)</ExecutablePath>
<IncludePath>$(DXSDK_DIR)Include;$(IncludePath)</IncludePath>
<LibraryPath>$(DXSDK_DIR)Lib\x64;$(LibraryPath)</LibraryPath>
使用 VS 2012 或更高版本,您必须 反转 它们,因为 Windows 8 SDK 中的大多数 headers 替换了旧的 DirectX SDK:
<ExecutablePath>$(ExecutablePath);$(DXSDK_DIR)Utilities\bin\x86</ExecutablePath>
<IncludePath>$(IncludePath);$(DXSDK_DIR)Include</IncludePath>
<LibraryPath>$(LibraryPath);$(DXSDK_DIR)Lib\x86</LibraryPath>
和
<ExecutablePath>$(ExecutablePath);$(DXSDK_DIR)Utilities\bin\x64;$(DXSDK_DIR)Utilities\bin\x86</ExecutablePath>
<IncludePath>$(IncludePath);$(DXSDK_DIR)Include</IncludePath>
<LibraryPath>$(LibraryPath);$(DXSDK_DIR)Lib\x64;</LibraryPath>
见MSDN, Where is the DirectX SDK (2015 Edition)?, The Zombie DirectX SDK, and Not So Direct Setup。
With all that said, you probably shouldn't be using legacy Direct3D 9 anyhow. Using DirectX 11 with one of the modern replacements for D3DX is a better, cleaner option and doesn't require the legacy DirectX SDK. See Living without D3DX.
如果您专门针对 运行 Windows 带有 Direct3D 9 的 XP SP3 上的程序,您将使用 v140_xp
平台工具集,它使用 Windows 7.1A SDK,不是 Windows 8.1 SDK。因此,您使用 old-school 包含顺序。有关详细信息,请参阅 this post。
在我开始之前,我知道这是一个很常见的问题,在 post 来到这里之前我确实搜索了答案。不幸的是,我没有运气。
在我的代码中,我包含了这样的文件:
#include <d3dx9.h>
现在出现错误:无法打开源文件d3dx9.h
在我的包含目录中,我确实输入了它所在的路径(如果我通过我的文件手动查找它,我可以在那里看到它)。
路径为:C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\Include
我还设置了图书馆目录:C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\Lib\x64
x64 因为我是 运行 64 位系统。
如果有人能花时间 post 提出建议,我将不胜感激。
你好。
Visual Studio 2015 包含 Windows 8.1 SDK,它比旧版 DirectX SDK 中的 headers 更新。 Windows 8.1 SDK 包括所有 DirectX headers 和库,但 不 包含现已弃用的 D3DX(D3DX9、D3DX10、D3DX11)实用程序库,这就是为什么它是 "missing".
D3DX9、D3DX10 和 D3DX11 仅在旧版 DirectX SDK 中可用。对于 VS 2010,您应该使用的 VC++ 目录设置对于 Win32 (x86) 设置如下:
<ExecutablePath>$(DXSDK_DIR)Utilities\bin\x86;$(ExecutablePath)</ExecutablePath>
<IncludePath>$(DXSDK_DIR)Include;$(IncludePath)</IncludePath>
<LibraryPath>$(DXSDK_DIR)Lib\x86;$(LibraryPath)</LibraryPath>
这对于 x64 本机:
<ExecutablePath>$(DXSDK_DIR)Utilities\bin\x64;$(DXSDK_DIR)Utilities\bin\x86;$(ExecutablePath)</ExecutablePath>
<IncludePath>$(DXSDK_DIR)Include;$(IncludePath)</IncludePath>
<LibraryPath>$(DXSDK_DIR)Lib\x64;$(LibraryPath)</LibraryPath>
使用 VS 2012 或更高版本,您必须 反转 它们,因为 Windows 8 SDK 中的大多数 headers 替换了旧的 DirectX SDK:
<ExecutablePath>$(ExecutablePath);$(DXSDK_DIR)Utilities\bin\x86</ExecutablePath>
<IncludePath>$(IncludePath);$(DXSDK_DIR)Include</IncludePath>
<LibraryPath>$(LibraryPath);$(DXSDK_DIR)Lib\x86</LibraryPath>
和
<ExecutablePath>$(ExecutablePath);$(DXSDK_DIR)Utilities\bin\x64;$(DXSDK_DIR)Utilities\bin\x86</ExecutablePath>
<IncludePath>$(IncludePath);$(DXSDK_DIR)Include</IncludePath>
<LibraryPath>$(LibraryPath);$(DXSDK_DIR)Lib\x64;</LibraryPath>
见MSDN, Where is the DirectX SDK (2015 Edition)?, The Zombie DirectX SDK, and Not So Direct Setup。
With all that said, you probably shouldn't be using legacy Direct3D 9 anyhow. Using DirectX 11 with one of the modern replacements for D3DX is a better, cleaner option and doesn't require the legacy DirectX SDK. See Living without D3DX.
如果您专门针对 运行 Windows 带有 Direct3D 9 的 XP SP3 上的程序,您将使用 v140_xp
平台工具集,它使用 Windows 7.1A SDK,不是 Windows 8.1 SDK。因此,您使用 old-school 包含顺序。有关详细信息,请参阅 this post。