#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.
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!