SDL + Xcode problems

Yea, I know you guys get a TON of these threads but I’ve read so many things online and still NEVER get it to work.
Here’s what I did:

  1. Downloaded the SDL-1.2.14.dmg under Mac OS X under Runtime Libraries
  2. Downloaded the SDL-devel-1.2.14-extras.dmg under Mac OS X under Development Libraries

These are the only 2 files I downloaded from the SDL website.
After downloaded these, I did the following:

  1. Mount the SDL-1.2.14.dmg
  2. Open it
  3. Copy SDL.framework into Libraries/Frameworks/ so the path to that folder will then become Libraries/Frameworks/SDL.framework
  4. Mount the SDL-devel-1.2.14-extras.dmg
  5. Open it
  6. Navigate via XcodeTemplates/TemplatesForXcodeSnowLeopard/ and find 3 folders: SDL Application, SDL Cocoa Application & SDL OpenGL Application
  7. Navigate to Libraries/Application Support/, create folder “Development”
  8. Navigate to Libraries/Application Support/Development/, create folder “Shared”
  9. Navigate to Libraries/Application Support/Development/Shared/, create folder “Xcode”
  10. Navigate to Libraries/Application Support/Development/Shared/Xcode/, create folder “Project Templates”
  11. Navigate to Libraries/Application Support/Development/Shared/Xcode/Project Templates/, create folder “Application”
  12. Navigate to Libraries/Application Support/Development/Shared/Xcode/Project Templates/Application/
  13. Copy the 3 SDL Application folders we found at step 6 to this location

Approach 1:
After this, I fired up Xcode, created a new project and just choose the SDL Application(I later tried the SDL Cocoa Application aswell). When trying to build and run the test-thing, it game me a compiler error:

error: There is no SDK with the name or path ‘macosx10.4’

After having gotten that error message, I tried editing the Info.plist and edit it to use 10.6 instead(since I’m on a Mac OS X 10.6.6). Still won’t work.

Approach 2:
I also tried create a regular C++ project and #include <SDL/SDL.h>, compiling this works great so at least the SDK version is correct aswell as it finding the SDL file to include! But when I add things like SDL_Init and SDL_Quit to just test the SDL-part of it, it gives me the famous:

“_main”, referenced from:
start in crt1.10.6.o
(maybe you meant: SDL_main(int, char* const*))

After having searched the forums a bit I read that I also need to #include <SDL/SDL_main.h>. I did that and it still gives me the error.
I also copied over the SDLMain.h from SDL-devel-1.2.14-extras.dmg/XCodeTemplates/TemplatesForXcodeSnowLeopard/SDL Application/SDLMain.h to the SDL.framework folder in Libraries/Frameworks as I’ve also read on the forums but it doesn’t work either.

ANY idea as to what could be the problem here??
Do I need to download the source aswell because I haven’t done that?

Really need SDL for this project so I would appreciate all the help I can get!
Cheers

The problem for #1 is you need to have the 10.4 SDK installed. Once
upon a time, it was a standard part of the Xcode install, but a lot of
time (in the Apple world) has passed. If you installed Xcode 4, I
don’t think you can install (easily) the 10.4 SDK.

Instead, you should try to change the SDK to 10.6 or compile 64-bit
only. The setting is in the Xcode project’s setting’s itself, not the
Info.plist.

See the second picture (under Updated Xcode Project Templates) here:
http://playcontrol.net/ewing/jibberjabber/big_behind-the-scenes_chang.html

For #2, you don’t want to #include SDL_main.h. There are two separate
files you need to compile with your project, SDLmain.h and SDLmain.m.
You don’t need to explictly #include them, but they are just two more
files that get compiled with your project. The Xcode template already
does this for you.

-Eric–
Beginning iPhone Games Development
http://playcontrol.net/iphonegamebook/

Changed the SDK version in the project settings and it works!!! Wow.
Thanks a bunch Eric! :slight_smile:

-Marcus

Even though everything works, I am getting some weird warnings, perhaps you can shed some light on them?

directory ‘/Users/Tanax/Library/Frameworks’ following -F not found

??

probably means the directory doesn’t exist. The reason XCode would look in
your home frameworks directory is just in case you have different versions
of certain frameworks there, compared to /Library/Frameworks. If you just
create the missing folder than the compiler (or linker in this case I think)
won’t complain anymore.

JohnOn Sat, Mar 12, 2011 at 4:53 AM, Tanax <Tanax.ms at gmail.com> wrote:

Even though everything works, I am getting some weird warnings, perhaps
you can shed some light on them?

Quote:

directory ‘/Users/Tanax/Library/Frameworks’ following -F not found

??


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

Worked like a charm! Thanks a bunch! This reaally helps me. I have to use SDL for a school-assignment that is due thursday :slight_smile: