Setting up the DirectX SDK with Visual Studio 2010


So I had a bit of time this morning and finally upgraded to visual studio 2010. There are a lot of changes but I am really enjoying it. It is a definite improvement over VS2008, some features that I have been begging for for years are finally in and the interface has been cleaned up significantly.

The new help system takes a bit of getting used to but it is only the first version and they promised that some massive improvements are coming.

Now Getting DX integrated with VS2010 was a bit tricky as the installer doesn’t automatically as the SDK include and lib folders to the default include/lib folders as it did in VS 2008, and it requires a bit of fiddling.

Setting up the Include and Library Paths

They removed the global VC path system accessible through the options dialog and have opted for a per-project path system with several global user files. This mean that for every single project that you make that uses the DX API you will need to add in the DX SDK directories manually via the project properties -> VC++ Directories (I’d personally recommend this technique since it allows projects to be more portable) but if you are lazy, you can add the SDK paths to the default c++ project settings template stored in the glocal cpp user file. This is done as follows:

Step 1: Open up the “Property Manager” under the “View” menu.

Step2: Expand the project/configurations tree and select the “Microsoft.Cpp.X.user” user file. Right click and select “Properties”.

Step3: Add the DX SDK include and Lib folders to the appropriate VC++ directories. Use the $(DXSDK_DIR) macro to future proof the setting. Click Ok, then exit VS2010, you will be prompted to save the user file, click yes and from now on the DXSDK folders will be set for any future C++ projects!

Linking the DirectX Static Libraries In Your Projects

Step1: Select the project properties from the project menu.

Step2: Expand the “Linker” section and select “Input” and under “Additional Dependencies” add the necessary lib files (D3D10.lib & D3DX10.lib).

NOTE: Make sure you select “All Configurations” from the drop down list in the top left hand corner, otherwise the lib files will only be loaded for the currently selected configuration.

And thats all there is to it! Now you will be able to include any directX headers without any problems (just remember to include the library files under the linker input for extra headers like DXGI)

About these ads

About Bobby
I'm a programmer at Ubisoft. My work interests include Animation and Artificial Intelligence. All opinions are my own!

23 Responses to Setting up the DirectX SDK with Visual Studio 2010

  1. touristtam says:

    Glad I found your page at the start of the Google search “add directx sdk visual studio 2010″ from the UK. :)

    Tam

  2. Pingback: See Also:

  3. Ivyn says:

    yeah, well, ive checked everywhere on my project properties. The linker section does not exist on it anywhere. Why can i not see it?

  4. Bobby says:

    make sure that you have at least one cpp file in the project before trying to set the linker options. They dont appear until you do.

  5. Pingback: - « Phoenix

  6. Papa_Mudd says:

    This would have saved me close to 50k if I had seen this several months earlier…

  7. hogsyhogsy says:

    Thanks for this good sir!

  8. drivenbyhim says:

    Thank you! I’ve looked for this solution before but never stumbled on your blog until today.

  9. Jimmy says:

    Thanks I started to code in DirectX again and forgot where to put the header files.

  10. rohits134 says:

    Reblogged this on itech.

  11. Michal says:

    Thank You very much.
    I cannot just set include and lib directories via properties for about 80 of ClanLib examples.
    I must make it globally.

  12. Jason Alls says:

    Thank you. You have help me upgrade a VC++ 2008 DirectX game to use VC++2010.

  13. Víctor Caballero says:

    After setting up it and follow every single step, I still have the error/s:

    error C2061: syntax error : identifier ‘__RPC__out_xcount_part’
    error C2059: syntax error : ‘)’
    fatal error C1903: unable to recover from previous error(s); stopping compilation

    and so on

    Any help??

  14. Michael Callaghan says:

    thanks man, was wasting so much time trying to get this to work :)

  15. zay says:

    Thanks great work sir.
    I’m a Newbie, follow all steps u suggest, when run, it shows an error.
    With heading “xxxxx.exe – Application Error”
    and content “The application was unable to start correctly (0xc000007b).Click OK to close the application.”
    Please help me….
    Thanks in advance!

  16. shaki says:

    nice guide! works!

  17. WoW Leveling Bot says:

    fantastic publish, very informative. I ponder why the opposite experts of this sector don’t understand this. You must continue your writing. I’m sure, you have a huge readers’ base already!

  18. Great post. I was checking constantly this blog and I am impressed!

    Very useful information specially the last part :)
    I care for such info much. I was seeking this
    certain information for a very long time. Thank you and
    good luck.

  19. Musasizi Benjamin says:

    Thank you Mr Bobby for this great masterpiece. Am personally interested in being a prolific game programmer, computer graphics and networking. However Am requesting you to help and tell me some of the pre-requisite IDEs that need to be installed before installing DirectX and the possible sites were I can get them. Thank you so much

  20. rajojon23 says:

    thanks a lot, this was very helpful.

  21. Pingback: How to setup DirectX in VisualStudio 2013 | Kodemaker

  22. sdfgsdf says:

    Why can Microsoft not document this properly…

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: