在win7下配置DirectX11的开发环境
先在微软官网下载 “DirectX Software Development Kit”,然后安装。如果之前安装过 Visual C++ 2010 Redistributable Package ,需要先卸载掉,否则SDK会安装失败。
安装成功后就可以打开vs进行项目配置了:
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: <inherit from parent or project defaults> (On right-side drop-down)
- Include Directories: $(IncludePath);$(DXSDK_DIR)Include
- Include Library Directories: $(LibraryPath);$(DXSDK_DIR)Lib\x86
- iv. Click Apply.
- v. Choose the x64 Platform.
- vi. Set the Library Directory as follows:
- Library Directories: $(LibraryPath);$(DXSDK_DIR)Lib\x64
1 //Include and link appropriate libraries and headers// 2 #pragma comment(lib, "d3d11.lib") 3 #pragma comment(lib, "d3dx11.lib") 4 #pragma comment(lib, "d3dx10.lib") 5 6 #include <windows.h> 7 #include <d3d11.h> 8 #include <d3dx11.h> 9 #include <d3dx10.h> 10 #include "xnamath.h"