微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

windows-8 – d3dx11.h不在Windows 8.0套件中

我的开发平台是windows 7 x64.我安装了VS2012,我想编译一个包含一些Dx11代码的项目.

具体来说,它包括以下文件

#include <d3dx11.h>
#include <d3dx10.h>

链接

#pragma comment (lib,"d3dx11.lib")
#pragma comment (lib,"d3dx10.lib")

我已经在我的开发机器上安装了VS2011,但是我想在VS2012中尝试本机C的单元测试工具.

由于安装了VS2011并在DirectShow代码上工作,所以我安装了Windows 7.1 SDK.

VS2012选择了这个,并引用了7.1 SDK,但是在使用7.1 SDK引用的VS2012下编译我的项目给出了错误

"warning C4005: '__useHeader' : macro redeFinition"

我google了这个,找到了a query like mine on social.msdn.microsoft.com.解决方案建议链接到Windows 8工具包而不是7.1 SDK,以解决这个问题.

Windows 8工具包包括头像d3d11.h,而不是d3dx11.h.

如何将d3dx11(来自Dx SDK)与Windows 8工具包一起添加,但不会得到多个“宏重定义”错误

我在 this MSDN page发现了以下令人讨厌的报价.

D3DX is not considered the canonical API for using Direct3D in Windows
8 and therefore isn’t included with the corresponding Windows SDK.
Investigate alternate solutions for working with the Direct3D API.

For legacy projects,such as the Windows 7 (and earlier) DirectX SDK
samples,the following steps are necessary to build applications with
D3DX using the DirectX SDK:

Modify the project’s VC++ directories as follows to use the right
order for SDK headers and libraries.

i. Open Properties for the project and select the VC++ Directories
page.
ii. Select All Configurations and All Platforms.
iii. Set these directories as follows:

Executable Directories: (On right-side drop-down)

Include Directories: $(IncludePath);$(Dxsdk_DIR)Include

Include Library Directories: $(LibraryPath);$(Dxsdk_DIR)Lib\x86



IV.单击应用.
v.选择x64平台.
六.设置库目录如下:

Library Directories: $(LibraryPath);$(Dxsdk_DIR)Lib\x64



无论“d3dx9.h”,“d3dx10.h”还是“d3dx11.h”都包含在您的
项目中,请务必明确包含“d3d9.h”,“d3d10.h”和
dxgi.h”或“d3d11.h”和“dxgi.h”,以确保您正在拾起
较新的版本.

如果需要,您可以禁用警告C4005;但是,这个警告
表示您正在使用这些标头的旧版本.

删除项目中对dxgiType.h的所有引用.这个标题
在Windows SDK和DirectX SDK版本中不存在
与新的winerror.h冲突.

所有D3DX DLL都由您的开发计算机安装
DirectX SDK安装.确保必要的D3DX依赖
与任何样品或您的应用程序重新分发,如果是
移动到另一台机器.

请注意,目前使用D3DX11的替代技术
包括DirectXTex和directxtk. D3DXMath被directxmath替代.

FFS微软,请不要像这样改变API的mid-version!

原文地址:https://www.jb51.cc/windows/371397.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐