DirectX Linking Errors

Started by
2 comments, last by Trandafira 16 years, 9 months ago
Hey guys... I've just installed VS 2005 and am having problems compiling. My first problem was that Visual studio couldn't find the d3d9.h / d3dx9.h etc files. I resolved this by adding the DirectX Directory to the VC++ Directories option in Options. However, how when i build i recieve link errors relating to DirectX: - error LNK2019: unresolved external symbol _D3DXVec4Transform@12 referenced in function "public: bool const __thiscall CBoundingBox::TransformVerticesByMatrix(struct D3DXMATRIX const &)" (?TransformVerticesByMatrix@CBoundingBox@@QAE?B_NABUD3DXMATRIX@@@Z) - error LNK2001: unresolved external symbol _GUID_SysKeyboard - unresolved external symbol _Direct3DCreate9@4 are just a few, basicly everything that has to do with DirectX =S.. Is there anyone who has experienced this problem too and could help me out? Thanks Jono
Advertisement
Sounds like you're not linking to the DirectX libraries. Add the lib directory from the SDK (make sure you pick the right platform - x86 or x64) to VC++'s Directories (under Library Files), and then specify the libraries that you need (d3d9.lib, etc.). You can do this by going to Project -> Properties -> Linker -> Command Line and writing them in Additional Options.
First make sure you've also added the correct path to DirectX libraries to VC++ Directories. To do so go to Tools->Options->Projects and Solutions->VC++ Directories->Choose "Library files" from the drop down list under "Show directories for:" and make sure to add the correct path for your platform, i.e. x86 or x64.
Afterwards go to the Project Property Page->Linker->Input->Additional Dependencies and add d3d9.lib, d3dx9.lib and dxguid.lib.
That's pretty much all you need to do.
aha! Thanks alot guys.

(Back to the crunch >_<)

This topic is closed to new replies.

Advertisement