views:

90

answers:

1

I've downloaded Direct X SDK from the microsoft website but when I try to compile my code i'm getting 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 have added Direct X to my C++ build directories like that:

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

I've googled it and found out that most of the time people were forgetting this line:

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

But it's there 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'm using Visual studio 2010 Professional on win7 x64

+3  A: 

Ok i've found the solution i've changed x64 to x86 in the build path. I was originally developping this project on a 32 bits machine so I guess the libraries weren't compatible. thanks for the help.

Josh
Aye don't try and link an x64 library with an x86 binary.
Goz