Setting up the DirectX SDK with Visual Studio 2010
July 2, 2010 23 Comments
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)