0

Hey so I want to draw text using dx11, so I got the suggestion to use the spriteFont library for that. I followed the Tutorial on GitHub but I get an unresolved external error now which shouldn't happen?:

Reference to unresolved external symbol ""public: __cdecl DirectX::SpriteBatch::SpriteBatch(struct ID3D11DeviceContext *)" (?? 0SpriteBatch@DirectX@@QEAA@PEAUID3D11DeviceContext@@Z)" in function ""class std::unique_ptr<class DirectX::SpriteBatch,struct std::default_delete<class DirectX: :SpriteBatch> > __cdecl std::make_unique<class DirectX::SpriteBatch,struct ID3D11DeviceContext * &,0>(struct ID3D11DeviceContext * &)" (? ?$make_unique@VSpriteBatch@DirectX@@AEAPEAUID3D11DeviceContext@@$0A@@std@@YA?AV?$unique_ptr@VSpriteBatch@DirectX@@U?$default_delete@VSpriteBatch@DirectX@@@std@@0@AEAPEAUID3D11DeviceContext@@Z)".

Code looks like this:

void rD3D11::test()
{
    std::unique_ptr<DirectX::SpriteBatch> spriteBatch;
    spriteBatch = std::make_unique<DirectX::SpriteBatch>(pContext);
}

If I uncomment the "spriteBatch = .." line the error disappears.

The code is very simple and I don't know what is wrong with it as this shouldn't trigger an unresolved external error? What code do I have to add / change in order to solve this error?

Nenntron
  • 9
  • 4
  • 1
    [Here](https://stackoverflow.com/q/12573816/509868) is a pretty general question with answers, which might explain what's going on here. If you want a more specific answer, you might have to amend your question. – anatolyg Nov 30 '21 at 23:46
  • I've read that already but it doesn't apply to my code – Nenntron Nov 30 '21 at 23:47
  • It most likely does. – drescherjm Dec 01 '21 at 00:57
  • You probably need to link to some library that implements this function: `DirectX::SpriteBatch::SpriteBatch(struct ID3D11DeviceContext *)` the source code for the library is in the github repository so my expectation is you are including the header but not linking to the library. – drescherjm Dec 01 '21 at 01:00

0 Answers0