Skip to main content
gamedev.net
🔒 Locked

help me please

Started by REALMLORD Dec 2, 2001 at 6:49 PM 6 replies 700+ views
Original Post
REALMLORD
REALMLORD
hi i have just bought the book " tricks of the game programming gurus ". i have typed out the freakout programme in the first part of the book and i keep getting 2 errors. first i am using visual C++ 6.0 standard edition compiler and i have installed the directX 6.1 sdk as well and i have included the ddraw.lib into my project as well. but i keep getting 2 errors coming up which are. here is the code that im using from the book: // BLACKBOX.h - header file for demo game engine library // watch for multiple inclusions #ifndef BLACKBOX #define BLACKBOX // DEFINES /////////////////////////////////////////////////////////// // default screen size #define SCREEN_WIDTH 640 // size of screen #define SCREEN_HEIGHT 480 #define SCRREN_BPP 8 // bits per pixel #define MAX_COLORS 256 // maximum colors // MACROS //////////////////////////////////////////////////////////// // these read the keyboard asynchronously #define KEY_DOWN(vk_code) ((GetAsyncKeyState(vk_code) & 0x8000) ? 1 : 0) #define KEY_UP(vk_code) ((GetAsyncKeyState(vk_code) & 0x8000) ? 0 : 1) // initializes a direct draw struct #define DD_INIT_STRUCT(ddstruct) { memset(&ddstruct,0,sizeof(ddstruct)); ddstruct.dwSize=sizeof(ddstruct); } // TYPES ///////////////////////////////////////////////////////////// // basic unsigned types typedef unsigned short USHORT; typedef unsigned short WORD; typedef unsigned char UCHAR; typedef unsigned char BYTE; // EXTERNALS //////////////////////////////////////////////////////// **extern LPDIRECTDRAW4 lpdd; // dd object extern LPDIRECTDRAWSURFACE4 lpddsprimary; // dd primary surface extern LPDIRECTDRAWSURFACE4 lpddsback; // dd back surface extern LPDIRECTDRAWPALETTE lpddpal; // a pointer to palette extern LPDIRECTDRAWCLIPPER lpddclipper; // dd clipper extern PALETTEENTRY palette[256]; // color palette extern PALETTEENTRY save_palette[256]; // used to save palettes extern DDSURFACEDESC2 ddsd; // dd surface desciption struct extern DDBLTFX ddbltfx; // used to fill extern DDSCAPS2 ddscaps; // dd surface capabilities struct extern HRESULT ddrval; // result back from dd calls extern DWORD start_clock_count; // used for timimg // these defined the general clipping rectangle extern int min_clip_x, // clipping rectangle max_clip_x, min_clip_y, max_clip_y; // these are over written globally by DD_Init() extern int screen_width, // width of screen screen_height, // height of screen screen_bpp; // bits per pixel // PROTOTYPES //////////////////////////////////////////////////////// // DirectDraw functions int DD_init(int width, int height, int bpp); int DD_Shutdown(void); LPDIRECTDRAWCLIPPER DD_Attach_Clipper(LPDIRECTDRAWSURFACE4 lpdds, int num_rects, LPRECT clip_list); int DD_Flip(void); int DD_Fill_Surface(LPDIRECTDRAWSURFACE4 lpdds, int color); // general utility functions DWORD Start_Clock(void); DWORD Get_Clock(void); DWORD Wait_Clock(DWORD count); // graphics funtions int Draw_Rectangle(int x1, int y1, int x2, int y2, int color, LPDIRECTDRAWSURFACE4 lpdds=lpddsback); // gdi functions int Draw_Text_GDI(char *text, int x,int y, COLORREF color, LPDIRECTDRAWSURFACE4 lpdds=lpddsback); int Draw_Text_GDI(char *text, int x,int y,int color, LPDIRECTDRAWSURFACE4 lpdds=lpddsback); #endif and these are the errors can any one help me to sort this problem out please: --------------------Configuration: FREAKOUT - Win32 Debug-------------------- Compiling... FREAKOUT.cpp c:\program files\microsoft visual studio\myprojects\freakout\blackbox.h(39) : error C2146: syntax error : missing '';'' before identifier ''lpdd'' c:\program files\microsoft visual studio\myprojects\freakout\blackbox.h(39) : fatal error C1004: unexpected end of file found Error executing cl.exe. FREAKOUT.obj - 2 error(s), 0 warning(s) I am "BORG" resistance is futile
I am "BORG" resistance is futile
Oluseyi
Oluseyi
quote:
Original post by REALMLORD
c:\program files\microsoft visual syntax error : missing '';'' before identifier ''lpdd''

The symbol LPDIRECTDRAW4 is not defined. I don''t see you include ddraw.h anywhere...
#include <ddraw.h> 

The thing is, though, that the version of DirectX that comes with MSVC is version 3; if you''ve installed one of the others (usually 7 or 8.x), you''ll need to either use those interfaces (LPDIRECTDRAW7) or tell DirectX to use version 4 (#define DIRECTDRAW_VERSION 0x0400, or something like that).

quote:
fatal error C1004: unexpected end of file found

This is simply due to the preceding error.
AdmiralBinary
AdmiralBinary
#include ddraw.h

At the top.
Do the bracket thingies too...
Hope this helps...

EDIT - Beat me again.

---------------

I finally got it all together...
...and then forgot where I put it.

Edited by - AdmiralBinary on December 2, 2001 8:05:27 PM
REALMLORD
REALMLORD
thanks for your replies but this is file is a .h file and its from the programme at the the beginning of tricks of the game programming gurus called freakout. i have installed the sdk that cam with the book which i think is version 6.1 and i copied it from the book word by word .i have included file in the freakout.cpp file. i have include the ddraw.lib file into the project as well. the 2 ** in the code at the top is just to mark the line where i am getting the error from its not included
in the original code. so dont think its a pointer to pointer cos its not. i have also told mscv to look into the sdk library files as well by clicking on tools options directories library files C:\mssdk\lib and include files C:\mssdk\include but im still getting this promblem. thanx guys and girls your help is much appreciated.

thank you

I am "BORG" resistance is futile
I am "BORG" resistance is futile
Oluseyi
Oluseyi
quote:
Original post by REALMLORD
i have also told mscv to look into the sdk library files as well by clicking on tools options directories library files C:\mssdk\lib and include files C:\mssdk\include...

Are they at the top of the list? MSVC searches in order from top to bottom, so if it finds the older DX3 headers that come with it first it''ll look in them for the declaration (which obviously isn''t there).
REALMLORD
REALMLORD
thanks alot for your help Oluseyi i wished i was as good as you at programming.

I am "BORG" resistance is futile
I am "BORG" resistance is futile
REALMLORD
REALMLORD
oh well Oluseyi that didnt work either but thanx im getting to learn more things about my compiler and how to navigate around it and im sorry about this but i am a newbie .

I am "BORG" resistance is futile
I am "BORG" resistance is futile

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.