LNK2001 and LNK2019 errors - DirectX unresolved external symbols

元气小坏坏 提交于 2019-12-03 21:03:45

RE: D3D11CreateDevice

You need to add d3d11.lib to your link library dependencies. An easy way to do that is to add to your .cpp source:

#pragma comment(lib,"d3d11.lib")

RE: D3DX11CompileFromFileW, D3DX11CreateTextureFromFile, D3DX11CreateShaderResourceViewFromFileW

D3DX11 is deprecated and is not part of the Windows 8.1 SDK which is built into VS 2013. See Where is the DirectX SDK?.

Remove #include <d3dx11.h> and d3dx11.lib from your link library dependencies.

Add #include <d3dcompiler.h> and d3dcompiler.lib from your link library dependencies.

Instead of using D3DX11CompileFromFileW, use D3DCompileFromFile.

The latest version of Effects 11 has D3DX11CreateEffectFromFile which can replace both D3DX11CompileFromFileW and D3DX11CreateEffectFromMemory since that's probably what you are doing there. You can add Effects 11 to your project via NuGet for VS 2013 Win32 desktop apps (fx11_desktop_2013).

Instead of D3DX11CreateTextureFromFile and D3DX11CreateShaderResourceViewFromFileW, use DDSTextureLoader functions CreateDDSTextureFromFile or CreateWICTextureFromFile from DirectX Tool Kit instead. You can add DirectX Tool Kit to your project via NuGet for VS 2013 (directxtk_desktop_2013).

RE: DXTraceW

Get the latest dxerr.cpp and dxerr.h from this post and add them to your project.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!