How to Setup The DirectX Programming

WON YONG LEE
4 min readApr 10, 2017

Today, I am going to talk about how to set up for the DirectX programming. The DirectX programming needs to be required before it starts. It needs Windows SDK, IDE for coding and input the library and directories path for D3D. It sounds like complex but I will explain step by step so you will be able to follow easily.

Windows SDK

First of all, you need to install the Windows SDK. Previously, it was called the DirectX SDK but recently it is included to the Windows SDK. It is available to download at the Microsoft Download Center. (Caution: You need to download the Windows 10 SDK. However, if you are using the operating system as Windows 7 or below version, you should download Windows 8.1 SDK or the appropriate version for your OS system. The Windows 10 SDK only support for the Windows 8.1 and higer version of Windows)

It is not hard to install. You need to set it up as the default setting.

Integrated Development Environment

In this blog post, I used the Visual Studio 2015 community version for the IDE. It is also able to download at the Microsoft Download Center and you can get a free license if you use the program for studying or noncommercial use.

Setup for the DirectX Programming

In this section, we are going to create a new project and add libraries and directories path for the DirectX programming.

Firstly, execute the Visual Studio program.

And then, click on the menu File → New → Project. You can see another screen like below image.

And then, select the Win32 project (Not the Win32 Console Application) and change the project name that you want and click on the OK button.

There will be another screen for setting.

Choose the Windows application (Not the Console application) and then the Empty project and uncheck the Security Development Lifecycle. (SDL) In this time, we do not need it. And click on Finish button.

Now, you got an empty project. In my last presentation, I unchecked the Empty and used the code which was provided by Microsoft. However, I do not recommend to use it because if you are learner, I strongly recommend that you try to type every code and understating every line of code. It will help you to improve your skill.

Right click on the Source Files folder and then AddNew Item. You can get a new screen and choose the C++ Files. (.cpp)

Set the file name and then click on the Add button.

So you can type the code now. I share my initialization code for the DirectX. I left some comment in order to help your understanding so try to read the code and try to understand as much as possible.

When you typed and executed the code, you are going to get an error message. This is because it is not completely setting. So we need to add libraries, directories path and setting for character set.

Right click on the project name and select the Properties. The new setup page comes up.

Under the VC++ Directories, add “$(DXSDK_DIR)Include;” at the Include Directories and Add “$(DXSDK_DIR)Lib\x86;$(DXSDK_DIR)Lib\x64;” at the Libraries Directories.

And under the LinkerInput, add winmm.lib;d3dx9d.lib;d3d9.lib;dxguid.lib;d3dxof.lib; at the Additional Dependencies. (Each directories should finish with ‘;’ and there should not be allowed any space between each directories)

At the General category, change the Character Set to Not Set. So the errors will disappear and you can execute the program.

When you execute the code, you can see the empty blue color screen. It is ready for starting the DirectX programming.

The steps described above are somewhat complex and seem to be a lot of work to do. However, it is not so difficult, and I think everybody can get one if you follow one by one.

Thank you for visiting my blog.

--

--