[SDL] Win 9x problems

Rob Probin rob at lightsoft.co.uk
Sun Jan 23 15:02:05 PST 2005


Hello,

> I have a header that has pointers to SDL_MouseMotionEvent and
> SDL_MouseButtonEvent,
> so at the top of the header I'm trying to forward declare these (then in the
> .cpp I include the
> appropriate header).

Um, this may be a stupid question, but what about including the SDL 
header(s) at the beginning of your headers? Is it really necessary to do 
forward declaration? Something like that is usually only used to work 
around circular declarations, and I doubt SDL code relies on things your 
code needs to declare first (though I could be wrong !-)

> I have tried both
> 
> struct SDL_MouseMotionEvent; and
> typedef struct MouseMotionEvent;

Both, as in "at the same time"? What happens if you only declare
struct SDL_MouseMotionEvent;
and comment out the other relevant portions of your code?

In my opinion, the code should be
   struct SDL_MouseMotionEvent;
   typedef struct SDL_MouseMotionEvent SDL_MouseMotionEvent;
EXCEPT that there may be conflicts trying to pre-declare C structures in 
C++ without surronding
   extern "C" {
   }
lines. But then again, I'm no expert in C++ name mangling...

Still, hope this helps,

   Ben Deutsch




More information about the SDL mailing list