VS 2017找不到DirectX包含文件 [英] VS 2017 won't find DirectX include files

查看:257
本文介绍了VS 2017找不到DirectX包含文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已安装DirectX SDK,并且想在Visual Studio 2017的C ++项目中使用。我配置了C ++包含路径,并在目录中添加了DirectX SDK包含文件( $(DXSDK_DIR) Include\ )可以正确解析为 C:\Program Files(x86)\Microsoft DirectX SDK(2010年6月)\Include\ 所有文件所在的位置


但是,当我尝试 #include< d3dx9core.h> 时,正确安装在 Include 目录中,它表示找不到文件。

I have installed the DirectX SDK and I want to use in my C++ project in Visual Studio 2017. I configured the C++ include path and added a directory with the DirectX SDK include files ($(DXSDK_DIR)Include\) which resolves correctly to C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\Include\ where all the files are located

But when I try to #include <d3dx9core.h> which, as I checked myself, is correctly installed in the Include directory, it says it can't find the file.

我该如何解决?

推荐答案

要将旧版DirectX SDK与VS 2010或更高版本一起使用,必须手动将引用添加到include / lib路径。通常,这是通过编辑项目的 VC ++目录设置来完成的,将DirectX SDK文件夹放在首位。

To use the legacy DirectX SDK with VS 2010 or later, you have to manually add references to the include/lib paths. This is typically done by editing the VC++ Directories settings for your project putting the DirectX SDK folders first.

要在VS 2012或更高版本中使用旧版DirectX SDK,您需要使用 reverse 路径顺序-在标准文件夹之后列出DirectX SDK文件夹-因为Windows 8.x / Windows 10 SDK包含的较新的标头DirectX SDK。当然,没有更新版本的D3DX9标头。

To use the legacy DirectX SDK with VS 2012 or later, you need use the reverse the path order--list the DirectX SDK folders after the standard ones--because Windows 8.x / Windows 10 SDK contains newer headers than the legacy DirectX SDK. Of course, there's no newer version of the D3DX9 headers.

对于x86 / Win32配置:

For x86/Win32 configurations:

$(ExecutablePath);$(DXSDK_DIR)Utilities\bin\x86
$(IncludePath);$(DXSDK_DIR)Include
$(LibraryPath);$(DXSDK_DIR)Lib\x86

对于x64本机配置:

$(ExecutablePath);$(DXSDK_DIR)Utilities\bin\x64;$(DXSDK_DIR)Utilities\bin\x86
$(IncludePath);$(DXSDK_DIR)Include
$(LibraryPath);$(DXSDK_DIR)Lib\x64

在执行此操作时,还有一些已知的问题已在 Microsoft文档。例如,在包含 d3dx9.h 之前,应明确包含 d3d9.h ,因为否则您将得到较旧的 d3d9.h 标头。

There are also a few known issues when doing this that are addressed on Microsoft Docs. For example, you should explicitly include d3d9.h before you include d3dx9.h because otherwise you'll end up with the older d3d9.h header.

BTW, dxerr.lib 静态库与VS 2015 / VS 2017 C / C ++运行时不兼容。 DXERR.LIB在哪里?

BTW, the dxerr.lib static libraries are not compatible with the VS 2015/VS 2017 C/C++ Runtime. Where’s DXERR.LIB?

一个最后一个陷阱:Windows 8.x或Windows 10不支持Direct3D 9调试设备。

One last gotcha: Direct3D 9 Debug Device is not supported on Windows 8.x or Windows 10.


请务必查看 DirectX SDK在哪里不是这样的DirectSetup DXSETUP更新

您还应该查看没有D3DX的生活 DirectX SDK工具目录 DirectX SDK示例目录 Zombie DirectX SDK

这篇关于VS 2017找不到DirectX包含文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆