Including the DirectX SDK libraries into your Visual C++ game project
1 min read
If you are new to DirectX game programming, you might have come across this pitfall:
You added the DirectX header to your main file and it didn’t compile because the files couldn’t be found.
#include <d3d11.h> #include <d3dx11.h> #include <d3dx10.h>
Fortunately, solving this problem is relatively straightforward.
Downloading the DirectX SDK
You will need the DirectX SDK Libraries from Microsoft. These contain the aforementioned header files and libraries. Download the latest DirectX SDK from here. When the download is complete, proceed by installing the DirectX SDK. Make sure you remember the installation location as you will need this later.
Installing the DirectX SDK
Add references to your project settings
In order to tell Visual Studio that your game requires DirectX, you will have to add the DirectX libraries and header files to your project.
- Open your project setting
- Navigate to VC++ Directories
- On the right, select Includepaths
- A new window will open, that lets you new include paths. Add a new include path by hitting the New Row button in the top right.
- Now you will have to navigate to your DirectX SDK installation directory and select the Include folder.
Do the same for the library path and you project should compile properly.29 Sep 2011