//
you're reading...
General

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 game programmer at IO Interactive. My work interests include Artificial Intelligence, Pathfinding and Computer Graphics. In my spare time I enjoying updating my blog, playing video games, watercooling my PC and keeping Monster Energy Drinks in business. All opinions are my own!

Discussion

18 Responses to “Setting up the DirectX SDK with Visual Studio 2010”

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

    Tam

    Posted by touristtam | February 5, 2011, 8:19 pm
  2. yeah, well, ive checked everywhere on my project properties. The linker section does not exist on it anywhere. Why can i not see it?

    Posted by Ivyn | May 10, 2011, 4:14 am
  3. 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.

    Posted by Bobby | May 11, 2011, 10:25 am
  4. This would have saved me close to 50k if I had seen this several months earlier…

    Posted by Papa_Mudd | August 10, 2011, 4:28 am
  5. Thanks for this good sir!

    Posted by hogsyhogsy | November 27, 2011, 12:31 am
  6. Thank you! I’ve looked for this solution before but never stumbled on your blog until today.

    Posted by drivenbyhim | April 14, 2012, 8:56 pm
  7. Thanks I started to code in DirectX again and forgot where to put the header files.

    Posted by Jimmy | June 11, 2012, 7:09 am
  8. Reblogged this on itech.

    Posted by rohits134 | July 3, 2012, 2:07 pm
  9. 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.

    Posted by Michal | July 14, 2012, 11:31 am
  10. Thank you. You have help me upgrade a VC++ 2008 DirectX game to use VC++2010.

    Posted by Jason Alls | August 23, 2012, 10:07 am
  11. 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??

    Posted by Víctor Caballero | November 8, 2012, 11:11 pm
  12. thanks man, was wasting so much time trying to get this to work :)

    Posted by Michael Callaghan | December 12, 2012, 3:05 am
  13. 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!

    Posted by zay | December 28, 2012, 4:38 pm
  14. nice guide! works!

    Posted by shaki | February 8, 2013, 7:27 pm

Trackbacks/Pingbacks

  1. Pingback: See Also: - February 16, 2011

  2. Pingback: - « Phoenix - July 2, 2011

  3. Pingback: DirectInput 8 linking errors | BlogoSfera - May 7, 2013

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 )

Connecting to %s

%d bloggers like this: