DX11 Unresolved Externals

时光毁灭记忆、已成空白 提交于 2019-12-02 04:38:20

问题


1>------ Build started: Project: Setup, Configuration: Debug Win32 ------
1>BoxDemo.obj : error LNK2019: unresolved external symbol _D3DX11CreateEffectFromMemory@24 referenced in function "private: void __thiscall BoxApp::BuildFX(void)" (?BuildFX@BoxApp@@AAEXXZ)
1>C:\Users\Josh\Documents\Game Institute\DirectX\Chapter 1\Projects\Setup\Debug\Setup.exe : fatal error LNK1120: 1 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

I'm using VS2012 and trying to setup DX11 using a sample program from Frank D Lunas DX11 book. I have no idea what this error message means, any help would be appreciated.


1>------ Build started: Project: Setup, Configuration: Debug Win32 ------
1>Effects11d.lib(EffectAPI.obj) : error LNK2019: unresolved external symbol _D3DCompileFromFile@36 referenced in function _D3DX11CompileEffectFromFile
1>C:\Users\Josh\Documents\Game Institute\DirectX\Chapter 1\Projects\Setup\Debug\Setup.exe : fatal error LNK1120: 1 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

回答1:


Linker cannot find definition of D3DX11CreateEffectFromMemory function. This function is a part of Effects11 framework. And you need to link Effects11.lib to build this program.

Previously, to develop DirectX apps, you must have been DirectX SDK installed. Now that stand-alone DirectX SDK concerned legacy and now it is a part of Windows SDK (since version 8.0). You`ve got it when installed Visual Studio 2012.

The problem is now this SDK version doesn't include Effect11 framework, among other things.

There are several ways to fix this problems:

  1. Download and install legacy DirectX SDK. When compiling you will get some warnings, because of conflicting old DirectX SDK and new Windows SDK. To solve this you can switch to your project to v110xp toolset or install Windows 7 SDK and switch to v100 in project's options.
  2. In case of this sample program, Mr. Luna included compiled libs in Common folder of source code archive. But I'm not sure if it will work with Win8 SDK.
  3. Correct source code and strip out Effect11 stuff. If you just learning DirectX, it is not easy way.

Some more explanation from Chuck Walbourn - MSFT:

  • Where is the DirectX SDK?
  • Effects for Direct3D 11 Update


来源:https://stackoverflow.com/questions/16642989/dx11-unresolved-externals

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