Engine linker help

Posted 08 July 2012 - 05:48 PM

Hey everyone, I just have a quick question about a custom game engine.

I'm currently making a game engine using DirectX and Visual Studio Beta 2011. I'm making it with help from the book Advanced 2d Game Programming by Jon Harbour. Now, the file for the engine is a lib file. To make it though, I'm using DirectX 9 SDK. I have the following files included:

#include <d3d9.h>
#include <d3dx9.h>
#include <dxerr9.h>

now, the only one that doesn't work is d3dx9.h. It says the program can't find the file. I haven't actually linked any of the libraries or included any outside files, as the book says you shouldn't have to. Am I reading this wrong, or do I have to include the libs and files for DirectX INTO the engine that i'm making, or into the project that I make WITH the engine? This probably all sounds confusing, but i'm very confused about this myself. Thanks guys!

Re: Engine linker help

If it's not actually finding d3dx9.h itself, it could be for a number of reasons:

1. Your includes path is wrong.
2. Your includes path is correct but the file is missing or elsewhere.
3. Both.

So, you need to verify your include paths via Tools -> Options -> Linker (if I recall correctly) and make sure the file is present.

As one last point, how are you including the file? Are you

#include <d3dx9.h>

or

#include "d3dx9.h"

The former will look in the path(s) set for your environment via linker options in tools with is specific to your environment. The latter will look in your current source files directory specific to your project.

Re: Engine linker help

Posted 09 July 2012 - 09:31 AM

I'm using the brackets to include the code. It's a custom engine being built around DirectX, more so that I don't have to use DirectX code after I finish this engine. I didn't link anything yet, which is why i'm confused at VS finding the other include files, but not that one. Linking it works, but I wasn't sure if that was what I wanted to do when it came to an engine.

Re: Engine linker help

Posted 14 July 2012 - 10:54 AM

stayscrisp, on 10 July 2012 - 01:40 AM, said:

Surely this book didn't include a library without instructions on how to link it?

It didn't really include a library, as much as it did make one. I know how to make applications in DirectX, but this book so far had gone over wrapping all the DX code into it's own library, and then exporting it to use in other projects as a .lib file. It just threw me off how the author stated that you don't need to link the DirectX files to the actual .lib project, and shouldn't get any linker errors (which I did). But after linking the DirectX libraries to the project, it compiled fine. I'm not too good with the whole Debug/Release stuff yet, as i'm more concerned with learning the language before I learn about getting working EXEs and all that. Appreciate all the help though, always get it here