Advertisement

Tricks of Windows Gaming Guru book chap 1 problem

Started by February 26, 2002 12:38 PM
14 comments, last by flawildcat 22 years, 7 months ago
Hey all, I just started reading and working on the Tricks of Windows Gaming Gurus book, but I''m stuck with a compiler problem. It''s been a wbile since I''ve worked with C++, so I''m sure that''s the problem.. anyhow, I have in the included files the blackbox.cpp, freakout.cpp, blackbox.h, Ddraw.lib, and ddraw.dll files. When I go to compile, I''m getting two errors: :\my documents\freakout\blackbox.h(34) : error C2146: syntax error : missing '';'' before identifier ''lpdd'' c:\my documents\freakout\blackbox.h(34) : fatal error C1004: unexpected end of file found Error executing cl.exe. I''m imagining I''m doing something wrong with the includes. Can anyone help or has anyone had this same problem? Thanks.
It means that one of the lines of code was terminated correctly. Double click the error that mentions the '';''. That will send you to the point in the code the compiler THINKS the problem is. Now start working your way back up the code looking for a missing semicolon. When you find it, that should take care of both errors.

Landsknecht
My sig used to be, "God was my co-pilot but we crashed in the mountains and I had to eat him..."
But folks whinned and I had to change it.
Advertisement
Hey I have that book as well. Here is a page that has corrections to the print. Just thought you may find it usefull.

TOTWGPG Errata

GRELLIN
Don''t sit and complain about a program, make a better one or shut up!
Steven Bradley .:Personal Journal:. .:WEBPLATES:. .:CGP Beginners Group:. "Time is our most precious resource yet it is the resource we most often waste." ~ Dr. R.M. Powell
Wow, hey that was a quick response. :-) Ok, I had checked for that already.. I guess I should have posted the point where the error occurred..
typedef unsigned char BYTE;

// EXTERNALS //////////////////////////////////////////////////

extern LPDIRECTDRAW4 lpdd; // dd object

it''s given me the error just before lpdd, it''s looking for a semi colon after LPDIRECTDRAW4.
It seemed to me that it''s not recognizing lpdd as a variable type. Still can''t get it to work. :-(
It might mean that you haven''t #include''d ddraw.h, or you haven''t set up your compiler to find the header.
In blackbox.h you need to have a '';'' after your class definition.

class CBlackBox
{
public:
void CBlackBox::Dosomething();
};

notice the semicolon after the closing bracket.
Advertisement
That error is telling you that the compiler doesn''t know what LPDIRECTDRAW4 is. It can be resolved by setting up your libraries and headers directories up correctly in MSVC++ and making sure you have the SDK installed correctly. I know that andre shows you how to setup the directories and headers propperly in the book perhaps you should look there. If not you can always start visual C++ up, goto tools, choose options , then choose the directories tab. Add in the correct directx sdk include directory to the include paths, then use the up arrow to move that directory to the top of the list. next click on the little drop down box and choose library files. Add the propper directx library directory to this, and then use the up arrow to move this to the top of the list also. when your done click ok and try to recompile. If this doesn''t solve the problem you forgot to link in the appropriate libraries and headers into your project. Goto project/settings/ choose the link tab. Then goto the area where you see all the .lib file names. Goto the end of that list and add in the appropriate library names like ddraw.lib . Then save those settings and recompile.
Aha.. that was it. I didn''t set up VC++ for the direct x. Thanks for all the help! I''ll be back soon with other problems, I''m sure! hehehe
Just wondering, anyone have opinions on that book? It looks worthwhile, but I''d like some feedback before I shell out the cash.

  cout<< "Hello, my name is Jerry\n";cout<< "I am happy\n";  
[source]cout<< "Hello, my name is Jerryn";cout<< "I am happyn";
Just wondering, anyone have opinions on that book? It looks worthwhile, but I''d like some feedback before I shell out the cash. -FCS

  cout<< "Hello, my name is Jerry\n";cout<< "I am happy\n";  
[source]cout<< "Hello, my name is Jerryn";cout<< "I am happyn";

This topic is closed to new replies.

Advertisement