Sign in to follow this  
ynkm169

Tricks of the Windows Game Programming Gurus

Recommended Posts

Hi: I just bought the book and when I tried to execute .exe files in the CD for the samples in the second half of the book, I get a "Send Error Report" message every time. Anyone knows what's up? How can I fix this? I read comments on Amazon, and people have this kind of problem too.

Share this post


Link to post
Share on other sites
The book probably comes with code. Compile it yourself and then debug it. This should tell you where in the code the error is coming from and, if you can't fix it yourself, we'll be in a better position to help you.

Share this post


Link to post
Share on other sites
It's a horrible book by an author renowned for his poor coding style which also happens to be 5 years old (assuming you've got the 2nd edition)?

But yes, if you can get it built a debug error location will help.

Share this post


Link to post
Share on other sites
As is typical of game programming books especially for beginners there is little/no error checking in the code so it's not suprising the code is crash prone.
Having gone through the book myself a while back you will have to make changes to most of the code to get it to compile with newer compilers and SDK's.
Off the top of my head I remember having to plug memory leaks,pointer problems,etc in the code.
If you are looking for an updated CD with updated code there is no such thing but if you post the particular code you are having trouble with there are plenty of C/C++ programmers around here that can help you out.

Share this post


Link to post
Share on other sites
I just tried to compile the final example Outpost (I created win32.exe instead of console application), but I got 11 linker error like similar to these:


t3dlib1.obj : error LNK2019: VC doesn't recogonize this:_DirectDrawCreateEx@16,
this is referenced in the function:int __cdecl DDraw_Init(int,int,int,int)..

t3dlib1.obj : error LNK2019: VC doesn't recogonize this:_DirectInput8Create@20
this is referenced in the function:int __cdecl DInput_Init(void)..

t3dlib1.obj : error LNK2019: VC doesn't recogonize this:_c_dfDIKeyboard..

t3dlib1.obj : error LNK2019: VC doesn't recogonize this:_c_dfDIJoystick..

t3dlib1.obj : error LNK2019: VC doesn't recogonize this:__imp__mmioAscend@12..

t3dlib1.obj : error LNK2019: VC doesn't recogonize this:__imp__mmioRead@12..

t3dlib1.obj : error LNK2019: VC doesn't recogonize this:__imp__mmioOpenA@12..

Sorry I am not familiar with configuring the compiler and the linker.
The aurthor asks to put DirectX SDK.LIB directory and .H directory in the search path. So I put the following in the solution search path:

"C:\Program Files\Microsoft DirectX SDK (December 2006)\Lib\x64(Is this x84 or x64?)/LIBPATH:[C:\Program Files\Microsoft DirectX SDK (December 2006)\Include]"

I am not sure if it's because the search path name is wrong or some other reason.

By the way, I am using foreign version of Visual Studio 2003 (super cheap like 3 USD). Lots of pain when I try to translate for example linker and compiler and search path. lol...

[Edited by - ynkm169 on April 5, 2007 6:10:26 PM]

Share this post


Link to post
Share on other sites
Oh yeah I rember this program now.
If I remember correctly you'll need to compile against an older DX SDK since as you can see it's trying to link to some DirectX8 stuff which isn't in the latest DX9 SDK anymore.
Also you need to link windows multimedia library that's what the mmio stuff is about ie winmm.lib.
You can get it to work with latest SDK if you have been programming for a while and know your way around code and read the DX9 help files since I remeber doing it but it was quite painful ie need to change dx 8 calls to dx9,etc.
Easiest thing would be to just rewrite the code for DX9 in the first place since the book used DX8 since that's what was available at the time or use the SDK off the cd to compile the code.

Share this post


Link to post
Share on other sites
Quote:

By the way, I am using foreign version of Visual Studio 2003 (super cheap like 3 USD). Lots of pain when I try to translate for example linker and compiler and search path. lol...


Did you get it legally?

Share this post


Link to post
Share on other sites
Quote:
Did you get it legally?


I got the software illegally..well the local police rarely care, and everyone including university proffesors buy illegal copies. So I assume it's not illegal haha.

Share this post


Link to post
Share on other sites

Hold on..
How do I include winmm.lib? I can't find it in the "add reference" dialog.

By the way, the author said the beauty of COM or directX is that your directX, directX2...whatever should work in directX9, 10, 11 without changes if I remember correct haha. This doesn't seems to be the case.

Share this post


Link to post
Share on other sites
Quote:
Original post by ynkm169


I got the software illegally..well the local police rarely care, and everyone including university proffesors buy illegal copies. So I assume it's not illegal haha.



Just because everyone else does it, doesn't mean piracy is right.

Share this post


Link to post
Share on other sites
Thanx for the help.

You mentioned winmm.lib because of the linker error __imp__mmioAscend...
I had no idea how to include it and where it is.
I googled winmm.lib and found out winmm.lib is in C:\Program Files\Microsoft Visual Studio .NET\Vc7\PlatformSDK\lib\winmm.lib on the following website:
<http://www.portaudio.com/docs/pa_tut_pc.html>
So I included it. Then the linker errors are reduced from 11 to 5.
I tried to include winmm.lib dsound.lib ddraw.lib dinput.lib dinput8.lib all and the next thing I knew I was playing the game!

As the author says, rookie programmers should put DirectX SDK.LIB directory and .H directory in the search path so that when they fail to compile they won't email the author about it. I havn't figure out how to do it yet, but the idea is the same as including the libs manually one by one

Now I see the beauty of COM. No previous DirectX needed, my new DirectX9 (December 2006) is perfectly fine.


Sry if my pirate software story affended you, I won't joke about again. It WAS just so common in my hometown, everyone buys it. There was actually a whole street dedicated to pirate softwares right in front of a famous university. Who cares about it? government?
No. Even microsoft? No...
This will change.

Share this post


Link to post
Share on other sites
Quote:
Original post by ynkm169

Hold on..
How do I include winmm.lib? I can't find it in the "add reference" dialog.

By the way, the author said the beauty of COM or directX is that your directX, directX2...whatever should work in directX9, 10, 11 without changes if I remember correct haha. This doesn't seems to be the case.

The author is correct for the most part. A game you made yesterday in DX7 or today in DX8,DX9,etc will work in future versions of directx(barring Vista of course which fails to support DX5 not to mention most directsound,etc). That is one guarantee MS made when they created it and that's one reason they got developers to get aboard the directx train. MS doesn't guarantee to include older DirectX libs,help files etc to build older directx apps in the latest DX SDK. Actuallly every time MS releases a new SDK they drop older stuff to keep the SDK side down that's part of the reason you are seeing the problems you are but it looks like you already figured that out.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this