Archived

This topic is now archived and is closed to further replies.

Aggro5288

HELP! stupid vc++ errors w/ dx! PLEASE LOOK!

Recommended Posts

I have been trying to fix this for 2 months. I am currwntly on chapter 6 of tricks of windows gurus. I have had no trouble compiling the normal windows programs, but I cant compile direct x programs. As a start I have been compiling "freakout" the beggining game. The visual c++ (intro one that comes w/ book) says: Compiling... freakout.cpp g:\source\t3dchap01\blackbox.h(34) : error C2146: syntax error : missing '';'' before identifier ''lpdd'' g:\source\t3dchap01\blackbox.h(34) : fatal error C1004: unexpected end of file found blackbox.cpp g:\source\t3dchap01\blackbox.h(34) : error C2146: syntax error : missing '';'' before identifier ''lpdd'' g:\source\t3dchap01\blackbox.h(34) : fatal error C1004: unexpected end of file found Error executing cl.exe. I know all the source is right and the direct draw files are in the project. I uninstalled the sdk and compiler and reinstalled them PLEASE HELP!!

Share this post


Link to post
Share on other sites
What type is lpdd? If it''s LPDIRECTDRAW# where # is a number like 2, 4, etc., then you may have an old version of DirectDraw and need to download the SDK (an older version of the SDK is probably on the Tricks CD).

~CGameProgrammer( );

Share this post


Link to post
Share on other sites
I already know how to program . . . I know how to compile I have had no trouble with the tricks book. I''m not sure why I would need a new sdk because i am trying to compile an example directly from the book. ( i have 6.1 sdk.) I was looking through the forums here and i found someone else had the exact same problem with the exact same files a few weeks ago. here are lines 1-34 of blackbox.h


// 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 SCREEN_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 the created dd palette
extern LPDIRECTDRAWCLIPPER lpddclipper; // dd clipper
extern PALETTEENTRY palette[256]; // color palette
extern PALETTEENTRY save_palette[256]; // used to save palettes
extern DDSURFACEDESC2 ddsd; // a direct draw surface description struct
extern DDBLTFX ddbltfx; // used to fill
extern DDSCAPS2 ddscaps; // a direct draw surface capabilities struct
extern HRESULT ddrval; // result back from dd calls
extern DWORD start_clock_count; // used for timing

// these defined the general clipping rectangle
extern int min_clip_x, // clipping rectangle
max_clip_x,
min_clip_y,
max_clip_y;

// these are overwritten 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 functions
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

Thanks

Share this post


Link to post
Share on other sites