## Recommended Posts

I am working on a DirectX project and I can build and link the project just fine without adding DxErr.lib to the project. When I add the line

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

To include the library, without even referencing it, I get a linking error to D3D11CreateDevice even though that function is defined in d3d11.lib.

Error 1 error LNK2019: unresolved external symbol _D3D11CreateDevice@40 referenced in function "public: __thiscall DX11Graphics::DX11Graphics(void)" (??0DX11Graphics@@QAE@XZ) DX11Graphics.obj DeferredRendering


If I don't include DxErr.lib then it links just fine.

Any thoughts as to why this is happening? This problem has me stumped.

##### Share on other sites

So I have been trying to fix this for a few hours now, and it turns out I just needed to include the 32 bit version of DxErr.lib instead of the 64 bit version. I seriously figured that out right after posting this question.

Even though it is working now I would still like to know if anybody has an explanation as to why it would work like that.

##### Share on other sites

If you create a 32-Bit application you need to use the 32-Bit libraries. This is independent of whether the operating system is 64-bit or 32-bit. This has something todo with the ABI (application binary interface) and AFAIK on Windows with the exception handling that has been changed massivly.