• Advertisement

Archived

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

Very weird error

This topic is 5555 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

Hi, I just got started on my first project and I already get a very bizarre error. This is my code: #include "stdafx.h" #include <stdio.h> #include <mmsystem.h> #include <ddraw.h> class TBreakout { LPDIRECTDRAW7 DirectDraw; public: TBreakout(); }; When I try to compile, I get this: error C2146: syntax error : missing '';'' before identifier ''DirectDraw'' error C2501: ''LPDIRECTDRAW7'' : missing storage-class or type specifiers error C2501: ''DirectDraw'' : missing storage-class or type specifiers As far as I can see, everything should be OK. I''ve set the path for the include files correctly (I use MS Visual C++ 6) and I have included ddraw.lib. What am I doing wrong? --------- http://users.pandora.be/koen.van.baelen ---------

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
What version of the SDK are you using ?

Share this post


Link to post
Share on other sites
Version 8.1. The most bizarre thing is that a few months ago, I created a little test project. Back then, it worked perfectly. When I try to compile it now, I get a load of error messages!

---------
http://users.pandora.be/koen.van.baelen
---------

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
libs?

Share this post


Link to post
Share on other sites
it's a compile error, libs won't help.

sounds like you're using old dd headers. double-check your setup.

[edited by - niyaw on December 7, 2002 8:32:00 AM]

Share this post


Link to post
Share on other sites
Reinstall the SDK, and change the paths in the compiler. Also, you need to include "DXGUID.LIB" into the project.

Sand Hawk

----------------
-Earth is 98% full. Please delete anybody you can.


My Site

Share this post


Link to post
Share on other sites
No, this didn''t help. I downloaded the most recent SDK (8.1b) and installed it. Still the same crap. It even happens with the samples from Microsoft!

---------
http://users.pandora.be/koen.van.baelen
---------

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
quote:
Original post by Koen VB
No, this didn''t help. I downloaded the most recent SDK (8.1b) and installed it. Still the same crap. It even happens with the samples from Microsoft!

So your include path is probably incorrect after all. Right-click on the line #include <ddraw.h> and select "Open document ddraw.h" from the context menu. Does VC say "File not found"?

Share this post


Link to post
Share on other sites
quote:
Original post by Anonymous Poster
So your include path is probably incorrect after all. Right-click on the line #include <ddraw.h> and select "Open document ddraw.h" from the context menu. Does VC say "File not found"?


No, the file opens correctly.



---------
http://users.pandora.be/koen.van.baelen
---------

Share this post


Link to post
Share on other sites
Maybe this will work

insert
#define DIRECTDRAW_VERSION 0x0700
before the include line

Share this post


Link to post
Share on other sites
Visual C++ comes with an older version of the directx headers. Make sure that the path to your include directory and library directory in your paths is configured correctly. And that they are at the top.. missing storage class would suggest that it hasn''t got the directdraw7 stuff in there..

=*=
If things seem bad, think that they can get a whole load worse, and they don''t seem so bad anymore

=*=

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
stdafx.h means you''re using a pre compiled header. #include <ddraw.h> should be in there, not your class. maybe that will help.

Share this post


Link to post
Share on other sites
I haven''t programmed too much in c++ but I would think that maybe you need to put LPDIRECTDRAW DirectDraw under private:
so the new class would be

class TBreakout
{
private:
LPDIRECTDRAW7 DirectDraw;

public:
TBreakout();
}

maybe that would help?

Share this post


Link to post
Share on other sites
I have solved the problem. It''s like hammerstein_02 said: the include directories for the DirectX headers were not on top of the list. I have moved them and now everything works fine. Thanks for the help, everybody!

---------
http://users.pandora.be/koen.van.baelen
---------

Share this post


Link to post
Share on other sites

  • Advertisement