0

I am reading a book on directx 11 and I have undertaken advised steps in order to be able to run the sample applications. Despite all of these steps, I am left with the following error:

Severity Code Description Project File Line Suppression State Error LNK2019 unresolved external symbol _D3DX11CreateEffectFromMemory@24 referenced in function "public: __thiscall Effect::Effect(struct ID3D11Device *,class std::basic_string<wchar_t,struct std::char_traits<wchar_t>,class std::allocator<wchar_t> > const &)" (??0Effect@@QAE@PAUID3D11Device@@ABV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@@Z) BlendDemo C:\Users\cmcl1\OneDrive\Documents\Chapter 9 Blending\BlendDemo\Effects.obj 1

What would the fix to this error be? Note, the steps I took can be found at the following link: https://www.d3dcoder.net/Data/Book4/d3d11Win10.htm

cmcl141
  • 17
  • 1
  • 1
    I believe the function `D3DX11CreateEffectFromMemory` requires that you link with `Effects11d.lib` (for debug versions) or `Effects11.lib` (for release builds). Are you doing this? – Andreas Wenzel May 22 '22 at 04:53
  • 1
    @AndreasWenzel is right. To run the samples in Luna's _Intro to 3D Game Programming with DirectX 11_, we had to build the included Effects framework project ourselves to create the **Effects11d.lib** static library. From memory we may also have needed to build the dynamic library **Effects11d.dll**. In any case the process was outlined in the book's introduction. Note the Effects framework was deprecated not long after its publication in 2012. – Maico De Blasio May 22 '22 at 05:21
  • For problems of lnk2019, please read the similar thread: [what-is-an-undefined-reference-unresolved-external-symbol-error-and-how-do-i-fix](https://stackoverflow.com/questions/12573816/what-is-an-undefined-reference-unresolved-external-symbol-error-and-how-do-i-fix). It is mostly caused by missing libraries. – Minxin Yu - MSFT Mar 17 '23 at 05:56

1 Answers1

2

You can obtain the latest version of the Effects for Direct3D 11 library from GitHub. It's also available as a NuGet package and a vcpkg port.

The Effects framework is considered legacy, and the support for building the fx_* profiles in the latest version of the FXC HLSL compiler will output a warning that it's deprecated. The key thing is that you won't find an equivalent "Effects framework" for DirectX 12. For more information see this blog post.

Frank Luna's book is excellent, but was published just before the DirectX SDK was deprecated along with D3DX9, D3DX10, and D3DX11. Instead of installing the legacy DirectX SDK itself (assuming you are using VS 2012 or later), you should use DirectXMath which is included in the Windows SDK per this migration guide, the Effects framework fx11_desktop_2017 NuGet, and Microsoft.DXSDK.D3DX NuGet package. See this blog post.

Chuck Walbourn
  • 38,259
  • 2
  • 58
  • 81