Since in the XCode distribution makes SDL a framework, you must use the
<frameworkname/header> notation for including headers from the
Alternatively, you can just add “/path/to/SDL.framework/Headers” to
your include paths in XCode, and then include “SDL.h” as normal:
I prefer the latter, if SDL.framework is installed in
/Library/Frameworks because it avoids the problems mentioned. Probably
best not to do it if SDL.framework is installed in the default
~/Library/Frameworks since your XCode project will then only work on
If you’re using Xcode and the SDL framework, it’s in
/Library/Frameworks/SDL.framework/Headers. The compiler will magically
find it when you say “#include <SDL/SDL.h>”, which of course is the
exact opposite of how SDL recommends you include files for
"portability" ("#include “SDL.h”, but do people really install SDL
headers directly into /usr/include these days?).
In Unix, the “recommended” way is “SDL.h”, with
adding eg. “-I/usr/include/SDL” to the gcc commandline.
This is ugly and horrible, of course, adding to the collection of trash
that tends to accumulate on compile commandlines. The correct way to
it is as you say: #include <SDL/SDL.h>, and only add a -I if the SDL
include directory isn’t in the default path (which it usually is), so
most compilations don’t need anything extra at all.
Apparently, some build environments can’t work when <SDL/SDL.h> is
I’d much sooner not support those broken environments and force them
a localized hack, than to deal with the above mess, though. A fix for
damage on one system shouldn’t make building on my system ugly.
Which build environments are you attempting to use? If you use gcc/g++
and SDL.framework is installed in /Library/Frameworks, then you
shouldn’t have to add anything to compile a file for it to find
SDL.framework, and “-framework SDL” to the gcc flags when you link. If
your build environment somehow doesn’t include /Library/Frameworks in
the default framework search paths, then something is probably wrong.
SDL mailing list
SDL at libsdl.org
Jeremy BellOn Apr 12, 2004, at 7:43 PM, Glenn Maynard wrote:
On Mon, Apr 12, 2004 at 09:33:53AM -0500, Hollis Blanchard wrote: