简体   繁体   中英

DirectX11 release VS 2010 C++

I compiled my code in VS C++ 2010. If I use debug version, everything is okay! If I want to make release version, I've got communicat:

main.cpp(7): fatal error C1083: Cannot open include file: 'd3dx11.h': No such file or directory

I use DirectX 11. What should I do?

As noted on MSDN , all versions of D3DX are deprecated including D3DX9, D3DX10, and D3DX11. You can certainly continue to use the deprecated libraries by using the legacy DirectX SDK. Remember that with VS 2010, you have to manually add the include/lib paths to your VC++ Directories properties page of your project to use the DirectX SDK with it.

For 32-bit Win32 configurations:

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

For x64 native configurations:

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

If you were able to get #include <d3dx11.h> to work for DEBUG builds, but not RELEASE, you probably failed to set the VC++ Directories for All Configurations / All Platforms.

Another option would instead be to move to VS 2012 or VS 2013 which includes the Windows 8.x SDK which has the DirectX SDK integrated into it. There you'd make use of DirectX Tool Kit , DirectXTex , DirectXMesh , and/or other replacements for legacy D3DX.

Note if you were making use of the legacy DirectX SDK to continue to use D3DX11 and were also using the Windows 8.x SDK (such as with VS 2012 or VS 2013), then you'd have to reverse the include order above because the legacy DirectX SDK headers are older than the ones in the Windows 8.x SDK.

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

For x64 native configurations:

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

Note you can get the Windows 8.1 SDK and DirectX Tool Kit to work with VS 2010 as noted here , but if you can I'd highly recommend using the VS 2013 Community edition if you don't have the budget for VS 2013 Professional or better.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM