#include "SDL/SDL.h" Vs. #include "SDL.h&quot

Bumpy.

On the Mac, 10.5.8, ppc, I cannot find “sdl-config” in the official distribution of SDL.
Specifying -FSDL to the compiler is not enough to let it find the SDL framework.

Code:
Kleiman-ibook:23 michael$ ls /Library/Frameworks/
total 0
0 Adobe AIR.framework/ 0 SDL_ttf.framework/
0 HPDeviceModel.framework/ 0 SFML.framework/
0 HPPml.framework/ 0 WOComponentElements.framework/
0 HPSMART.framework/ 0 WOComponentExamples.framework/
0 HPServicesInterface.framework/ 0 WOExamplesHarness.framework/
0 HPSmartPrint.framework/ 0 WOSessionStoreExample.framework/
0 JavaBusinessLogic.framework/ 0 iMoviePluginAPI.framework/
0 JavaMonitorSupport.framework/ 0 sfml-audio.framework/
0 JavaRealEstate.framework/ 0 sfml-graphics.framework/
0 PetStoreWOModel.framework/ 0 sfml-network.framework/
0 SDL.framework/ 0 sfml-system.framework/
0 SDL_image.framework/ 0 sfml-window.framework/
0 SDL_mixer.framework/ 0 sndfile.framework/
0 SDL_net.framework/
Kleiman-ibook:23 michael$ make

  • [UFO] src/client/cl_console.c
    In file included from src/client/client.h:32,
    from src/client/cl_console.c:30:
    src/client/cl_renderer.h:34:17: error: SDL.h: No such file or directory

Code:
Kleiman-ibook:23 michael$ egrep CFLAG Makefile
CFLAGS= -I/opt/local/include -arch i386 -arch ppc
SDL_CFLAGS=-FSDL

Naturally, the <SDL/SDL.h> version works, but apparently that’s a no-no (odd, as lots of packages seem to like being packaged inside a directory). Do I really need to add 5 -I statements for the 5 frameworks for SDL to work?

Also: Should the include statement be

#include "SDL.h"
or
#include <SDL.h>

Somehow, I thought that quotes were for your local project includes and the angle brackets for system includes.------------------------
(placeholder)

#include <SDL/SDL.h> with work for your SDL Framework on OS X, but
then you would need to do:
#include <SDL_image/SDL_image.h>
#include <SDL_mixer/SDL_mixer.h>
etc.

For frameworks, the “path” is actually the framework name.

#include “SDL.h” is recommended for maximum code portability. Some
distributions don’t always put things in a directory called “SDL”.
Haven’t verified in awhile, but once upon a time, FreeBSD put
everything in a directory called SDL11 (even though it was 1.2). And
obviously, OS X frameworks are going to have issues.

So yes, you will need to add a long string of -I statements if you
don’t do the #include <SDL_image/SDL_image.h> stuff. I don’t think
you’ll need the -F flags though since your frameworks are in standard
locations and the linker will find these correctly/automatically.

Some systems have special or different search paths for angle brackets
than quotes. Generally speaking, quotes are better for things that
aren’t in these special compiler paths.

-EricOn 8/4/10, Keybounce wrote:

Bumpy.

On the Mac, 10.5.8, ppc, I cannot find “sdl-config” in the official
distribution of SDL.
Specifying -FSDL to the compiler is not enough to let it find the SDL
framework.

Code:
Kleiman-ibook:23 michael$ ls /Library/Frameworks/
total 0
0 Adobe AIR.framework/ 0 SDL_ttf.framework/
0 HPDeviceModel.framework/ 0 SFML.framework/
0 HPPml.framework/ 0 WOComponentElements.framework/
0 HPSMART.framework/ 0 WOComponentExamples.framework/
0 HPServicesInterface.framework/ 0 WOExamplesHarness.framework/
0 HPSmartPrint.framework/ 0 WOSessionStoreExample.framework/
0 JavaBusinessLogic.framework/ 0 iMoviePluginAPI.framework/
0 JavaMonitorSupport.framework/ 0 sfml-audio.framework/
0 JavaRealEstate.framework/ 0 sfml-graphics.framework/
0 PetStoreWOModel.framework/ 0 sfml-network.framework/
0 SDL.framework/ 0 sfml-system.framework/
0 SDL_image.framework/ 0 sfml-window.framework/
0 SDL_mixer.framework/ 0 sndfile.framework/
0 SDL_net.framework/
Kleiman-ibook:23 michael$ make

  • [UFO] src/client/cl_console.c
    In file included from src/client/client.h:32,
    from src/client/cl_console.c:30:
    src/client/cl_renderer.h:34:17: error: SDL.h: No such file or directory

Code:
Kleiman-ibook:23 michael$ egrep CFLAG Makefile
CFLAGS= -I/opt/local/include -arch i386 -arch ppc
SDL_CFLAGS=-FSDL

Naturally, the <SDL/SDL.h> version works, but apparently that’s a no-no
(odd, as lots of packages seem to like being packaged inside a directory).
Do I really need to add 5 -I statements for the 5 frameworks for SDL to
work?

Also: Should the include statement be

#include "SDL.h"
or
#include <SDL.h>

I solved this problem two ways in my days of Mac OS X developing before
Apple stabbed the FOSS community in the back :frowning:

Solution A) Create your own sdl-config. It’s really simple.

Solution B) Write a little more code to include the necessary headers.
Here’s how I accomplished that:

#ifdef APPLE

include <SDL/SDL.h>

include <OpenGL/GL.h>

#else

include <SDL.h>

include <GL/gl.h>

#endif

Of course that solution is just from memory of many years ago, so it has a
few rough edges. When you or someone else tries to build your package on
another system, it quickly becomes apparent what the problem is and a fix is
usually easy to implement, so the absence of a real standard portable
one-liner isn’t that critical :)On Wed, Aug 4, 2010 at 12:18 PM, Keybounce wrote:

Bumpy.

On the Mac, 10.5.8, ppc, I cannot find “sdl-config” in the official
distribution of SDL.
Specifying -FSDL to the compiler is not enough to let it find the SDL
framework.

Code: Kleiman-ibook:23 michael$ ls /Library/Frameworks/
total 0
0 Adobe AIR.framework/ 0 SDL_ttf.framework/
0 HPDeviceModel.framework/ 0 SFML.framework/
0 HPPml.framework/ 0 WOComponentElements.framework/
0 HPSMART.framework/ 0 WOComponentExamples.framework/
0 HPServicesInterface.framework/ 0 WOExamplesHarness.framework/
0 HPSmartPrint.framework/ 0 WOSessionStoreExample.framework/
0 JavaBusinessLogic.framework/ 0 iMoviePluginAPI.framework/
0 JavaMonitorSupport.framework/ 0 sfml-audio.framework/
0 JavaRealEstate.framework/ 0 sfml-graphics.framework/
0 PetStoreWOModel.framework/ 0 sfml-network.framework/
0 SDL.framework/ 0 sfml-system.framework/
0 SDL_image.framework/ 0 sfml-window.framework/
0 SDL_mixer.framework/ 0 sndfile.framework/
0 SDL_net.framework/
Kleiman-ibook:23 michael$ make

  • [UFO] src/client/cl_console.c
    In file included from src/client/client.h:32,
    from src/client/cl_console.c:30:
    src/client/cl_renderer.h:34:17: error: SDL.h: No such file or directory
    Code: Kleiman-ibook:23 michael$ egrep CFLAG Makefile
    CFLAGS= -I/opt/local/include -arch i386 -arch ppc
    SDL_CFLAGS=-FSDL

Naturally, the version works, but apparently that’s a no-no (odd, as lots
of packages seem to like being packaged inside a directory). Do I really
need to add 5 -I statements for the 5 frameworks for SDL to work?

Also: Should the include statement be

#include "SDL.h"
or
#include

Somehow, I thought that quotes were for your local project includes and the
angle brackets for system includes.


(placeholder)


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


http://codebad.com/

Solution A) Create your own sdl-config. It’s really simple.

I think that this solution.

Solution B) Write a little more code to include the necessary headers.
Here’s how I accomplished that:

#ifdef APPLE

include <SDL/SDL.h>

include <OpenGL/GL.h>

#else

include <SDL.h>

include <GL/gl.h>

#endif

There is also a third solution ©, that I think it’s the better:

Add the additional platform dependant include/link paths and flags to your
build system files (makefiles, cmakelists.txt, xcode project, visual studio
project…).

It’s always better to modify a project setting to make a project build on a
particular platform/machine/enviroment that have to modify the sources with
the risk of breaking the build on another platform or enviroment.

Also, as Eric says, always use “” for non-system headers, not <>.–
Bye,
Gabry

I solved this problem two ways in my days of Mac OS X developing before
Apple stabbed the FOSS community in the back :frowning:

when and how did this happen?

Solution A) Create your own sdl-config. It’s really simple.

Solution B) Write a little more code to include the necessary headers.
Here’s how I accomplished that:

#ifdef APPLE

include <SDL/SDL.h>

include <OpenGL/GL.h>

#else

include <SDL.h>

include <GL/gl.h>

#endif

Of course that solution is just from memory of many years ago, so it has a
few rough edges. When you or someone else tries to build your package on
another system, it quickly becomes apparent what the problem is and a fix is
usually easy to implement, so the absence of a real standard portable
one-liner isn’t that critical :slight_smile:

as mentioned by others, #include “SDL.h” will work for most cases on most
platforms.
bye
VittorioOn Thu, Aug 5, 2010 at 12:45 AM, Donny Viszneki <donny.viszneki at gmail.com>wrote:

I solved this problem two ways in my days of Mac OS X developing
before Apple stabbed the FOSS community in the back :frowning:

when and how did this happen?

Solution A) Create your own sdl-config. It's really simple.

Solution B) Write a little more code to include the necessary

headers. Here’s how I accomplished that:

#ifdef APPLE
#  include <SDL/SDL.h>
#  include <OpenGL/GL.h>
#else
#  include <SDL.h>
#  include <GL/gl.h>
#endif

Of course that solution is just from memory of many years ago, so

it has a few rough edges. When you or someone else tries to build your
package on another system, it quickly becomes apparent what the
problem is and a fix is usually easy to implement, so the absence of a
real standard portable one-liner isn’t that critical :slight_smile:

as mentioned by others, #include “SDL.h” will work for most cases on
most platforms.
bye
VittorioOn Thu, Aug 5, 2010 at 12:45 AM, Donny Viszneki <donny.viszneki at gmail.com> wrote:

I concur. And FYI, CMake already handles this case correctly and
transparently if you use #include “SDL.h”
#include "SDL_image.h"
et al.

I made sure of that :wink:

-EricOn 8/5/10, Gabriele Greco <gabriele.greco at darts.it> wrote:

Solution A) Create your own sdl-config. It’s really simple.

I think that this solution.

Solution B) Write a little more code to include the necessary headers.
Here’s how I accomplished that:

#ifdef APPLE

include <SDL/SDL.h>

include <OpenGL/GL.h>

#else

include <SDL.h>

include <GL/gl.h>

#endif

There is also a third solution ©, that I think it’s the better:

Add the additional platform dependant include/link paths and flags to your
build system files (makefiles, cmakelists.txt, xcode project, visual studio
project…).

It’s always better to modify a project setting to make a project build on a
particular platform/machine/enviroment that have to modify the sources with
the risk of breaking the build on another platform or enviroment.

Also, as Eric says, always use “” for non-system headers, not <>.


Bye,
Gabry