[SDL] forward decleration problem
kos at climaxgroup.com
Mon Jan 10 00:53:07 PST 2005
I think you're missing the point...
goes without saying...otherwise you get redefintion problems...
What I'm talking about is that with the GNU compiler you can't do this:
void SomeMethod(SDL_MouseMotionEvent* event);
which you should be able to...
Then in foo.cpp you can have
void foo::SomeMethod(SDL_MouseMotionEvent* event)
// do something with event here
From: sdl-bounces+kos=climaxgroup.com at libsdl.org
[mailto:sdl-bounces+kos=climaxgroup.com at libsdl.org]On Behalf Of Justin
Sent: 07 January 2005 20:10
To: A list for developers using the SDL library. (includes SDL-announce)
Subject: Re: [SDL] forward decleration problem
On Fri, 7 Jan 2005 19:22:45 -0000, Kostas Kostiadis <kos at climaxgroup.com>
> To answer your other question, I don't like including headers in header
> files unless I have to. It creates hude dependancy trees that on
> some platforms (e.g. GameCube) are very problematic (especialy
> on large projects). So, as a habit, I prefer to use pointers and
> references in headers for things I can forward declare and then include
> the relevant headers in the implementation files when I actualy need to
> use these types.
With MSVC 6 and 7 you can put
at the beginning of the header, and it will only be included once,
regardless of how many other files (or levels) include it.
If you're not using MSVC, I believe you can wrap your headers like this:
... all your declarations etc here...
#endif /* MY_HEADER_H */
That way again it will only get included once. That should be portable
to any ANSI C++ compiler, and I believe any ANSI C compiler as well.
Hope this helps.
SDL mailing list
SDL at libsdl.org
More information about the SDL