Direct x c++

Does anyone know of any way to use directX 9 with dev-c++ 4.9.9.2

i had recently bought a book on directx but i cannot figure out where to get directx for devc++

if not i do have visual studio any tutorials or links to downloads for that would also be helpful thank you very much and have a nice day
Hi gsizzle10,

to use DirectX you need to get the DirectX SDK (Software Development Kit) -- the IDE you choose to use (such as Dev-C++, Visual Studio etc) is up to you. The latest version of the SDK is the June 2010 version, found here:

http://www.microsoft.com/en-us/download/details.aspx?id=6812

This version includes everything needed to write applications not only for DirectX 9 but up to DirectX 11. There's also a download that has the DirectX 9 SDK only:

http://www.microsoft.com/en-us/download/details.aspx?id=31210

Once you have the SDK installed you need to include the required DirectX headers and lib files so that your program can compile successfully. You can do that in any IDE you choose.

As for Dev-C++, I have to say that the 4.9.9.2 version is pretty old. It was released on 2005 I think (and no newer versions came out). You may want to look into Code::Blocks as a more recent alternative. Although I'd personally recommend Visual Studio for DirectX programming (there is also a free version called Visual Studio Express).

For setting up DirectX with Visual Studio, there are a number of PDFs on www.d3dcoder.net (this is the website of Frank Luna, an author on DirectX programming) but the DirectX 9 section doesn't have any. Here's one describing the process for DirectX 10 and Visual Studio 2008. It's old (and used the March 2008 version of the SDK) but it's quite informative. Also note that it is intended as a guide on how to compile the source code accompanying the books, but it describes all the steps needed for setting up a DirectX project from scratch. So just skip the final step where the source code for the books is brought into the project and use your own code.

http://www.d3dcoder.net/Data/Book3/VS08Setup.pdf

Hope this helps,

Ogoyant
Last edited on
Ogoyant,

Thank you very much for your help i do in fact own visual studio 2010, and i actually just recently bought a book on directx and 2d game development but it goes through how to include the directx files for VS2008 which i do not own, and it did not work. Do you know of any tutorials on installing directx for visual studio with VS2010 because ive searched the internet for a few hours and have come up empty handed.

Thank you this would be a great help,
gsizzle10
You're welcome gsizzle10.

I see. I use VS2010 as well. I learned how to set up DirectX from books rather than online tutorials, but I'll go over the process here. First of all, it is best you get the June 2010 SDK, use the first link I provided earlier if you don't already have it. Once you have the SDK installed, you can create a new project. (I recently went over this in a different thread but here goes):

Go to File -> New -> Project and create an "Empty Project".

Once you have the project created, you need to add the required directories so that the required headers and libs for DirectX are successfully found upon compiling the program.

Go to Project -> (Project name's) Properties -> Configuration Properties -> VC++ Directories. You need to edit the "Include Directories" and "Library Directories".

In "Include Directories", add
$(DXSDK_DIR)Include
and in "Library Directories" add
$(DXSDK_DIR)Lib\x86
(for 32-bit, and $(DXSDK_DIR)Lib\x64 for 64-bit).

"$(DXSDK_DIR)" is a macro that is set when the DirectX SDK is installed, and corresponds to the directory that the SDK is installed in. (The default directory is "C:\Program Files\Microsoft DirectX SDK (June 2010)\ ", and this is essentially substituted with "$(DXSDK_DIR)" ).

Go to Project -> (Project name's) Properties -> Configuration Properties -> Linker -> Input. You need to add the required lib files. I think that for a DirectX 9 application you'd need to add these
d3d9.lib
d3dx9d.lib
dxerr.lib
dxguid.lib

(d3dx9d.lib is for the Debug builds -- d3dx9.lib should be used instead for Release builds)

Last, add the related Windows and DirectX 9 headers to your code:
1
2
3
#include <windows.h>
#include <d3dx9.h>
#include <dxerr.h> 


I think that's all that needs to be set for a project to successfully compile with DirectX 9.

Ogoyant

EDIT: When installing the SDK it's best you choose "DirectX Runtime Support -- Debug" (rather than Retail). This makes debugging the application easier.
Last edited on
Thank you so much for taking the time to type all of that out it helped me alot and now i dont have to throw a fit trying to figure this out anymore. I appreciate your help so much if i can ever repay you just ask me
You're welcome gsizzle10, nice to know this helped you out!

Ogoyant
Topic archived. No new replies allowed.