How to set visual studio 10.0 to work with directx

Started by
7 comments, last by merkaba48 14 years, 3 months ago
Please help i get an error while compilling 1>sdk.cpp(6): fatal error C1083: Cannot open include file: 'd3dx9.h': No such file or directory I am new to directx so please help. My program include files look like: #include <StdAfx.h> #include <windows.h> #include <windowsx.h> #include <d3d9.h> #include <d3dx9.h> And #include <d3dx9.h> is underlined with red curved line.Please help. Thanks in advance.
Advertisement
You'll want to go to "Project" then "Properties" then "VC++ Directories". You'll want to add the "include" folder and the "lib" folder to the top of the "include directories" and "library directories" from the direct x SDK installation directory. The 'lib' folder you'll most likely be interested in will be the x86 subdirectory of the lib folder. In summary, you'll probably have these directories added:

include-->C:\Program Files (x86)\Microsoft DirectX SDK (March 2009)\Include
library-->C:\Program Files (x86)\Microsoft DirectX SDK (March 2009)\Lib\x86

or wherever they are on your hard drive.

C++: A Dialog | C++0x Features: Part1 (lambdas, auto, static_assert) , Part 2 (rvalue references) , Part 3 (decltype) | Write Games | Fix Your Timestep!

Oh, and I forgot you'll probably need to inform the compiler of which .lib files you want to link against. You do this at "project", "properties", "linker->input", and "additional dependencies". Then you'll need to mention all the .lib files you are using, probably D3dx9.lib and D3d9.lib

C++: A Dialog | C++0x Features: Part1 (lambdas, auto, static_assert) , Part 2 (rvalue references) , Part 3 (decltype) | Write Games | Fix Your Timestep!

Go to ProjectProperties -> Linker->Input->addional dependencies and include
d3dx9.lib

If you get to same error again then check directx path in Visual Studio.
Refer to this link for detailed information on setting up directx with vc++ -
http://www.uc-forum.com/forum/programming-beginners/61112-setting-up-vc-and-directx.html

My Game Development Blog : chetanjags.wordpress.com

Quote:Original post by Chetanhl
Go to ProjectProperties -> Linker->Input->addional dependencies and include
d3dx9.lib

If you get to same error again then check directx path in Visual Studio.
Refer to this link for detailed information on setting up directx with vc++ -
http://www.uc-forum.com/forum/programming-beginners/61112-setting-up-vc-and-directx.html


First, he obviously didn't have the paths set up correctly because his error was about not finding a header file. He would eventually need to follow your instructions after fixing the compile time error, but you jumped the gun a bit :). Second of all, that forum gives instructions for pre-2010 versions of Visual Studio. The method of setting up include/library directories has changed since 2008 was released. It now must be set up for every project in the project properties section instead of in the application options.

C++: A Dialog | C++0x Features: Part1 (lambdas, auto, static_assert) , Part 2 (rvalue references) , Part 3 (decltype) | Write Games | Fix Your Timestep!

Guys I had done everything you said,but now i get 3 new errors:
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\objidl.h(11280): error C2061: syntax error : identifier '__RPC__out_xcount_part'
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\objidl.h(11281): error C2059: syntax error : ')'
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\objidl.h(11281): fatal error C1903: unable to recover from previous error(s); stopping compilation
Please help.
PS.
I found many tutorials on setting directx settings for visual studios 2008(or before)but none for visual c++ 2010 express so please take that in mind please.
Thank you.
Please help anybody.
I was having problems with finding the d3dx9.lib and header file too. I realised I was putting the Include and Library/x86 folders into the wrong part of the settings (This is with Visual C++ Express Studio 2010)

Here is what you should do, then what you shouldn't:

Go into Project -> Properties -> VC++ Directories

In the 'Include Directories' section, select your Program Files\Microsoft DirectX SDK\Include directory
In the 'Library Directories' section, select your Program Files\Microsoft DirectX SDK\lib\x86

That should be ALL you have to do (in my case, anyway).

What you should NOT do, and what I think is the cause of many people having problems is:

(Do not!) Go into Project -> Properties -> C/C++ -> General
(Do not!) In the 'Additional Include Directories', put in your Include folder and Library folders.

Doing that will result in it asking for d3dx9.lib, which must be specified in the correct manner shown above.

This topic is closed to new replies.

Advertisement