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

Started by
7 comments, last by Aggro5288 22 years, 2 months ago
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!!
A chain is only as strong as its weakest link.
Advertisement
Did you remember to add the ddraw.lib and ddraw.h files to your project? And write ''include "ddraw.h"'' at the top of your source file?
No, Canadians DON'T all live in igloos. They live in one BIG igloo!
Yeah i did everything I think im cursed because i tried dev c++ vc++ and tried to download borland and nothing works
A chain is only as strong as its weakest link.
Please post lines 1 to 34 inclusive of blackbox.h.

[ MSVC Fixes | STL | SDL | Game AI | Sockets | C++ Faq Lite | Boost ]
See this thread here.

It also might help to get comfortable with programming before attempting DirectX code.

-scott
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( );

~CGameProgrammer( );Developer Image Exchange -- New Features: Upload screenshots of your games (size is unlimited) and upload the game itself (up to 10MB). Free. No registration needed.
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
A chain is only as strong as its weakest link.
Have you tried to include the direct draw header on top of blackbox.h?
I just got it to work thanks everyone
A chain is only as strong as its weakest link.

This topic is closed to new replies.

Advertisement