[SDL] Header inclusion, was Re: A problem about SDL

Tom Barnes-Lawrence tomble at usermail.com
Mon Jun 25 23:35:07 PDT 2007


Hi, OTish, but:

On Mon, 25 Jun 2007 08:03:32 -0700
Sam Lantinga <slouken at devolution.com> wrote:

> > try
> 
> > #include <SDL/SDL.h>
> 
> > instead of
> 
> > #include "SDL/SDL.h"
> 
> The most portable way is:
> #include "SDL.h"
> 
> and then use sdl-config on Unix to set up the correct include path.

I remember reading this in the past, and following that advice. I then got
a *really confusing* error report from someone trying to compile the project
I'd used it in, about it not finding whatever include files in such-and-such
directory, and people complained that I should be using sdl-config to get
the paths and not hard coding them. But I *HAD* been using sdl-config, I
hadn't hard-coded the paths at all. I was quite baffled.

Turns out, it was because I had bundled the up-to-date Makefile.dep file
my build process made, which was only reasonable, ordinary users shouldn't
need to regenerate the dependancy info. But the standard process for doing
this considers headers included between ""s to be parts of your project,
compared to those between < > brackets, which it considers to be system
headers. So it was also putting all the SDL header's paths (and their own
dependancies too? I forget, this was years ago) in the Makefile.dep, and
screwing things up for people who had SDL installed in different places
to me.

Obviously I could've removed the file before distributing, but it had never
occurred to me I might have to. Is this inclusion of SDL headers in
with the dependancy info actually desirable behaviour somehow? (it seems
wrong to me) If so, is that why #include "SDL.h" is considerd more portable,
or is it that maybe some compilers won't accept non-standard paths being
included the other way?

Meanwhile I tend to just use #include <SDL.h> nowadays, and it doesn't give
me problems, but maybe it would in some other circumstances, so I'm curious.

-Tom Barnes-Lawrence
(BTW, thanks to Kostas Kostiadis for replying to my earlier question, even
if he didn't quite answer it- it was encouraging advice at least, and I
ended up just trying what seemed obvious and it worked easily!)
-- 
I think I need a new signature


More information about the SDL mailing list