During compile time I get the following error:
RAT_RendererDX9.obj : error LNK2019: unresolved external symbol _Direct3DCreate9@4 referenced in function "public: void __thiscall RAT_ENGINE::RAT_RendererDX9::Init(class RAT_ENGINE::RAT_WindowManager *)" (?Init@RAT_RendererDX9@RAT_ENGINE@@QAEXPAVRAT_WindowManager@2@@Z)
The only place that I use Direct3DCreate9
is in my Init()
function of the Renderer which has the following code:
void RAT_RendererDX9::Init(RAT_WindowManager* argWMan)
{
wMan = argWMan;
g_pD3D = (LPDIRECT3D9)Direct3DCreate9( D3D_SDK_VERSION );
D3DPRESENT_PARAMETERS d3dpp;
ZeroMemory( &d3dpp, sizeof( d3dpp ) );
d3dpp.Windowed = TRUE;
d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;
d3dpp.BackBufferFormat = D3DFMT_UNKNOWN;
g_pD3D->CreateDevice( D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, hWnd,
D3DCREATE_SOFTWARE_VERTEXPROCESSING,
&d3dpp, &g_pd3dDevice );
}
Where does this error come from and how can I solve it?
I've tried the other answers to LNK2019, but they didn't resolve my problem.
I had to add the d3d9.lib file to my linker's additional dependencies, just like GSerg said.