Archived

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

DirectX troubles

This topic is 6362 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Ive been using LaMothe''s "Tricks" book to learn how to use DirectX. I posted this in the directx message board as well but Im looking for all the help I could get. When I try to compile my own program or his using his setup I get a few errors I can''t resolve. here are my includes#include #include #include #include #include #include #include // I also included ddraw.lib to my project manually according to the book the errors occur in this section of code LPDIRECTDRAW lpdd = NULL; // dd object LPDIRECTDRAW4 lpdd4 = NULL; // dd4 object // errors in line above LPDIRECTDRAWSURFACE4 lpddsprimary = NULL; // dd primary surfac LPDIRECTDRAWSURFACE4 lpddsback = NULL; // dd back surface LPDIRECTDRAWPALETTE lpddpal = NULL; // a pointer to LPDIRECTDRAWCLIPPER lpddclipper = NULL; // dd clipper PALETTEENTRY palette[256]; // color palette PALETTEENTRY save_palette[256]; // used to save DDSURFACEDESC2 ddsd; // a direct draw DDBLTFX ddbltfx; // used to fill DDSCAPS2 ddscaps; // a direct draw HRESULT ddrval; // result back from DWORD start_clock_count = 0; // used for timing errors: D:\prog\source.cpp(55) : error C2146: syntax error : missing '';'' before identifier ''lpdd4'' D:\prog\source.cpp(55) : error C2501: ''LPDIRECTDRAW4'' : missing storage-class or type specifiers D:\prog\source.cpp(55) : fatal error C1004: unexpected end of file found I have no clue to get rid of the errors, could it have anything to do with my having DirectX 7.0a on my computer and the book using DX 6? I dont know, but any help would be greatly appreciated. Thanks

Share this post


Link to post
Share on other sites
Sorry but I really dont know!

See the errors you got (missing storage class thingy) occur when VC cant find the structure definition.
Now I checked out DDRAW.H (which you are including) and low and behold both LPDIRECTDRAW and LPDIRECTDRAW4 are declared as pointers to the relevant structures.

So the only things I can think of are this:
1) Its not including DDRAW.H properly
2) For some reason it is including another DDRAW.H from somewhere else

So do this:

Change your #include to be :
#include "ddraw.h"

and then go to your Tools menu, select Options, and then go to the Directories tab. Highlight all your directx include directories and move them ABOVE the Visual C include directories.
Why?
Because its possible Visual C''s includes have a DDraw.h somewhere in them and its using VC''s DDraw.h and not the one from DirectX.

Then try recompile. Hope this helps.



regards,

GeniX

Share this post


Link to post
Share on other sites