[SDL] forward decleration problem
jmcoleman at gmail.com
Fri Jan 7 12:09:45 PST 2005
On Fri, 7 Jan 2005 19:22:45 -0000, Kostas Kostiadis <kos at climaxgroup.com> wrote:
> 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.
More information about the SDL