#include "SDL/SDL.h" Vs. #include "SDL.h"?

#include “SDL/SDL.h” Vs. #include “SDL.h” ???

Hi,

I use SDL to design cross-platform video games.

Which is the correct method to include SDL in my sources?
#include "SDL/SDL.h"
OR
#include “SDL.h”

On Linux it seems to be: #include "SDL/SDL.h"
and
on Windows it seems to be: #include “SDL.h”

Just trying to have 1 code base for all platforms.
My current (ugly) solution is the following:
//------------------------------------------------------------------------------
#ifdef WIN32
#include “SDL.h”
#include “SDL_image.h”
#include “SDL_ttf.h”
#include “SDL_opengl.h”
#else
#include “SDL/SDL.h”
#include “SDL/SDL_image.h”
#include “SDL/SDL_ttf.h”
#include “SDL/SDL_opengl.h”
#endif
//------------------------------------------------------------------------------

Anyone have an ideas about this?
Thanks…

JeZ+Lee
SLNTHERO at aol.com
www.SilentHeroProductions.com

Jesse Palser writes:

[…]

On Linux it seems to be: #include “SDL/SDL.h”

No. “sdl-config --cflags” outputs -I/usr/include/SDL (among other
things), so the code should read also #include “SDL.h”.–
Alberto

It is recommended to use “SDL.h” on every platform. Use compiler options or
project options (depending on your IDE) to add the …/include/SDL path to
your compiler search directories. For gcc, this is something like
-I/usr/include/SDL. This is what I do, but it’s even better to use sdl-config --cflags (backticks necessary) and use sdl-config --libs as a linker
option.

Jonny DOn Wed, Feb 17, 2010 at 7:58 AM, Jesse Palser wrote:

#include “SDL/SDL.h” Vs. #include “SDL.h” ???

Hi,

I use SDL to design cross-platform video games.

Which is the correct method to include SDL in my sources?
#include "SDL/SDL.h"
OR
#include “SDL.h”

On Linux it seems to be: #include "SDL/SDL.h"
and
on Windows it seems to be: #include “SDL.h”

Just trying to have 1 code base for all platforms.
My current (ugly) solution is the following:

//------------------------------------------------------------------------------
#ifdef WIN32
#include “SDL.h”
#include “SDL_image.h”
#include “SDL_ttf.h”
#include “SDL_opengl.h”
#else
#include “SDL/SDL.h”
#include “SDL/SDL_image.h”
#include “SDL/SDL_ttf.h”
#include “SDL/SDL_opengl.h”
#endif

//------------------------------------------------------------------------------

Anyone have an ideas about this?
Thanks…

JeZ+Lee
SLNTHERO at aol.com
www.SilentHeroProductions.com


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Backticks when calling from a shell, but in a Makefile you can (and I think
should?) do it as, e.g.:

SDL_CFLAGS=$(shell sdl-config --cflags)
SDL_LIBS=$(shell sdl-config --libs)

Just mentioning…

-bill!On Wed, Feb 17, 2010 at 08:07:51AM -0500, Jonathan Dearborn wrote:

It is recommended to use “SDL.h” on every platform. *Use compiler options
or project options (depending on your IDE) to add the …/include/SDL path
to your compiler search directories. *For gcc, this is something like
-I/usr/include/SDL. *This is what I do, but it’s even better to use
sdl-config --cflags (backticks necessary) and use sdl-config --libs as
a linker option.

Bill Kendrick writes:> On Wed, Feb 17, 2010 at 08:07:51AM -0500, Jonathan Dearborn wrote:

It is recommended to use “SDL.h” on every platform. *Use compiler options
or project options (depending on your IDE) to add the …/include/SDL path
to your compiler search directories. *For gcc, this is something like
-I/usr/include/SDL. *This is what I do, but it’s even better to use
sdl-config --cflags (backticks necessary) and use sdl-config --libs as
a linker option.

Backticks when calling from a shell, but in a Makefile you can (and I think
should?) do it as, e.g.:

SDL_CFLAGS=$(shell sdl-config --cflags)
SDL_LIBS=$(shell sdl-config --libs)

Just mentioning…

In addition, in bash shell at least, you can use $() instead of the backticks:

$(sdl-config --cflags)
$(sdl-config --libs)


Alberto