25 Replies - 1718 Views - Last Post: 22 March 2012 - 12:39 PM
#1
Problem with Frank Luna's book
Posted 22 August 2011 - 05:23 AM
Over the last 2 weeks, I have been slowly absorbing DirectX knowledge from Frank Luna's "Introduction to 3D game programming with DirectX 9.0c. A shader approach."
The problem I'm having is that when compiling the code for chapter 4, an error message saying C1083: Cannot open include file: 'dxerr9.h': No such file or directory.
So I linked the libraries and the includes into visual studio as I have done before, and this always worked.
But it didn't solve the problem at hand.
I looked online and some posts stated that the include is out of date.
So I looked into the DirectX SDK folders and noticed that there is a header\lib file for DxErr.
I changed the include statement to #include <DxErr>, which did nothing.
The I tried changing it to #include <dxerr>, and this too did nothing.
So my question is, what can I do to fix this problem?
To those that have read this book, did you have the same problem? Are there any future issues that I will bump into that you can warn me about?
Thanks in advance.
Replies To: Problem with Frank Luna's book
#2
Re: Problem with Frank Luna's book
Posted 22 August 2011 - 05:38 AM
#3
Re: Problem with Frank Luna's book
Posted 22 August 2011 - 07:02 AM
#4
Re: Problem with Frank Luna's book
Posted 22 August 2011 - 08:39 AM
stayscrisp, on 22 August 2011 - 07:02 AM, said:
I changed it to that before and got the same error message
error LNK1104: cannot open file 'DxErr9.lib'
It also created a new warning saying:
Warning 1 warning C4996: 'strcpy': This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS.
#5
Re: Problem with Frank Luna's book
Posted 22 August 2011 - 08:45 AM
You can disable that warning with a pragma like this:
#pragma warning(disable: 4996)
It is a microsoft specific warning and you can just ignore it if you like or replace with the suggested function. It depends what you're going to be doing or if you plan on distributing your code.
#6
Re: Problem with Frank Luna's book
Posted 22 August 2011 - 09:21 AM
But I still get the same error :S
This is the header file that the error points to.
//=============================================================================
// d3dUtil.h by Frank Luna (C) 2005 All Rights Reserved.
//
// Contains various utility code for DirectX applications, such as, clean up
// and debugging code.
//=============================================================================
#ifndef D3DUTIL_H
#define D3DUTIL_H
// Enable extra D3D debugging in debug builds if using the debug DirectX runtime.
// This makes D3D objects work well in the debugger watch window, but slows down
// performance slightly.
#if defined(DEBUG) | defined(_DEBUG)
#ifndef D3D_DEBUG_INFO
#define D3D_DEBUG_INFO
#endif
#endif
#include <d3d9.h>
#include <d3dx9.h>
#include <DxErr.h>
#include <string>
#include <sstream>
#pragma comment(lib, "DxErr.lib") // I added this line as this is how I usually libraries.
//===============================================================
// Globals for convenient access.
class D3DApp;
extern D3DApp* gd3dApp;
extern IDirect3DDevice9* gd3dDevice;
//===============================================================
// Clean up
#define ReleaseCOM(x) { if(x){ x->Release();x = 0; } }
//===============================================================
// Debug
#if defined(DEBUG) | defined(_DEBUG)
#ifndef HR
#define HR(x) \
{ \
HRESULT hr = x; \
if(FAILED(hr)) \
{ \
DXTrace(__FILE__, __LINE__, hr, #x, TRUE); \
} \
}
#endif
#else
#ifndef HR
#define HR(x) x;
#endif
#endif
#endif // D3DUTIL_H
I've added a pragma statement to include the library, but this has no effect.
Any ideas?
This post has been edited by DivideByZero: 22 August 2011 - 09:24 AM
#7
Re: Problem with Frank Luna's book
Posted 22 August 2011 - 10:04 AM
Remove this line or use a different way of sending error messages.
DXTrace(__FILE__, __LINE__, hr, #x, TRUE);
Then remove the header and be done with it. It's not worth your time to get this to work when there are many other ways to get debug feedback
#8
Re: Problem with Frank Luna's book
Posted 22 August 2011 - 11:21 AM
I've removed the HR macro in the header (as there are some other headers in the d3dutil.h that the other classes relied on, so I couldn't just delete it as I got 200+ errors when deleting it).
I then went through all the code to remove where the macro was being used.
I then deleted the include <DxErr> and built the project as it should work fine.
But for some baffling reason, the error message still says that it can't find DxErr!
Nowhere in the code includes it, so why does it expect it?
I'm going to take a break as this is really annoying me.
Thanks again for helping me get started with DirectX so far.
This post has been edited by DivideByZero: 22 August 2011 - 11:22 AM
#9
Re: Problem with Frank Luna's book
Posted 22 August 2011 - 11:27 AM
#10
Re: Problem with Frank Luna's book
Posted 22 August 2011 - 11:37 AM
#11
Re: Problem with Frank Luna's book
Posted 22 August 2011 - 01:25 PM
I do hope that you can get this to work out. When you find the solution please let us know what it is. I've been considering going through that book and it would be nice to head that problem off at the pass.
#12
Re: Problem with Frank Luna's book
Posted 22 August 2011 - 03:56 PM
This is a common problem with porting code either between platforms of moving a code base from an older to newer version.
This post has been edited by ButchDean: 22 August 2011 - 03:58 PM
#13
Re: Problem with Frank Luna's book
Posted 23 August 2011 - 02:16 AM
The thread you linked recommends downloading the December 2004 SDK, so I did a quick google and managed to find that SDK.
I'll give it a download when I get back from work and hopefully I can actually begin with DirectX after 2 weeks
Edit: I have a 64bit windows 7 laptop that I do my work in.
My main IDE is Visual Studio 2010 professional edition.
My error senses are tingling and I'm predicting that this will be a problem considering windows 7 and visual studio 2008-2010 weren't released when this SDK came out.
Do you guys know if this will work on my setup?
I installed Visual Studio 2008 last night, just in case, but I'm curious to know if this will be a problem.
This post has been edited by DivideByZero: 23 August 2011 - 02:25 AM
#14
Re: Problem with Frank Luna's book
Posted 23 August 2011 - 02:35 AM
#15
Re: Problem with Frank Luna's book
Posted 24 August 2011 - 12:56 PM
I uninstalled the sdk and reinstalled the december 2004 sdk.
I then added the lib and include dependencies into visual studio 2008.
Then I built the project and an error saying "Error spawning cl.exe".
Any ideas?
|
|

New Topic/Question
This topic is locked




MultiQuote







|