Setting up Direct X for C ++

I downloaded the Direct X SDK from the Microsoft website, but when I try to compile my code, I get this error:

Error   1   error LNK2019: unresolved external symbol _Direct3DCreate9@4 referenced in function "void __cdecl initD3D(struct HWND__ *)" (?initD3D@@YAXPAUHWND__@@@Z)    C:\Users\Josh\Desktop\Tutorial\Tutorial\Tutorial.obj    Tutorial

      

I added Direct X to my C ++ build directories:

$(DXSDK_DIR)include
$(DXSDK_DIR)Lib\x64

      

I searched for it and found out that most of the time people forgot this line:

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

      

But this for me here are my includes and lib:

#include <windows.h>
#include <windowsx.h>
#include <d3d9.h>
#include <d3dx9.h>

#pragma comment (lib, "d3d9.lib")
#pragma comment (lib, "d3dx9.lib")

      

Can anyone help me with this? I am using Visual Studio 2010 Professional on win7 x64

+2


a source to share


1 answer


Ok, I found a solution that I changed x64 to x86 in the build path. I originally developed this project on a 32 bit machine, so I guess the libraries were not compatible. thanks for the help.



+4


a source







All Articles