Can't get SDL to work... Help please!

floxwoop
Unregistered
 
Post: #1
Hi, I can't get any SDL applications to link properly, not even the XCode templates. It always fail with 2 linking errors:

Code:
Building target “test” of project “test”


Checking Dependencies
JamToolExecution test
    cd /Users/fredrikf/Desktop/test
    setenv ASCII_OUTPUT_ANNOTATION YES
    setenv ENABLE_APPLE_JAM_EXTENSIONS YES
    setenv ENABLE_APPLE_JAM_OUTPUT_ANNOTATION YES
    setenv GROUP fredrikf
    setenv NATIVE_ARCH i386
    setenv USER fredrikf
    /Developer/Private/jam -d1 -j2 JAMBASE=/Developer/Makefiles/pbx_jamfiles/ProjectBuilderJambase JAMFILE=/Users/fredrikf/Desktop/test/build/test.build/Development/test.build/test.jam build ACTION=build _DEFAULT_GCC_VERSION=4.0 GCC_VERSION_IDENTIFIER=4_0 CONFIGURATION=Development BUILD_STYLE=Development CPP_HEADERMAP_FILE=/Users/fredrikf/Desktop/test/build/test.build/Development/test.build/test.hmap CLEAN_PRECOMPS=YES SRCROOT=/Users/fredrikf/Desktop/test OBJROOT=/Users/fredrikf/Desktop/test/build SYMROOT=/Users/fredrikf/Desktop/test/build DSTROOT=/tmp/test.dst

StandaloneExecutable /Users/fredrikf/Desktop/test/build/Development/test.app/Contents/MacOS/test /Users/fredrikf/Desktop/test/build/test.build/Development/test.build/Objects-normal/i386/SDLMain.o /Users/fredrikf/Desktop/test/build/test.build/Development/test.build/Objects-normal/i386/main.o /System/Library/Frameworks/Cocoa.framework /Library/Frameworks/SDL.framework


StandaloneExecutable.LinkUsingFileList /Users/fredrikf/Desktop/test/build/Development/test.app/Contents/MacOS/test /Users/fredrikf/Desktop/test/build/test.build/Development/test.build/Objects-normal/LinkFileList
    /usr/bin/gcc-4.0  -o /Users/fredrikf/Desktop/test/build/Development/test.app/Contents/MacOS/test  "-L/Users/fredrikf/Desktop/test/build/Development"  "-F/Users/fredrikf/Desktop/test/build/Development" "-F/Library/Frameworks"  -filelist /Users/fredrikf/Desktop/test/build/test.build/Development/test.build/Objects-normal/LinkFileList  "-arch" "i386" "-Wl,-no_arch_warnings" "-framework" "SDL"   "-framework" "Cocoa" "-framework" "SDL"
/usr/bin/ld: Undefined symbols:
_SDL_PushEvent
_SDL_GetError
_SDL_Init
_SDL_PollEvent
_SDL_Quit
_SDL_SetVideoMode
collect2: ld returned 1 exit status

where I belive the most helpful (to someone, not me) is in these lines:

Code:
/usr/bin/ld: Undefined symbols:
_SDL_PushEvent
_SDL_GetError
_SDL_Init
_SDL_PollEvent
_SDL_Quit
_SDL_SetVideoMode
collect2: ld returned 1 exit status

I read another thread where LWStrike (?) seemed to have the same problems but he didn't say how he solved it. I am quite new to Xcode so i'd really appreciate any help I can get.

I am using an iMac core duo, Mac OS X 10.4.6 and XCode 2.2.1. I have installed the SDL runtime and developer libraries.
Quote this message in a reply
Moderator
Posts: 508
Joined: 2002.09
Post: #2
You have two options:

1. Don't build as a universal binary (ie in the targets inspector, set the architecture to PowerPC only)
2. Use a universal binary version of SDL, which doesn't exist, but you can build it yourself from source. Download everything from this site and then run the script. It will download a bunch of libraries and frameworks and compile them for PPC and Intel or for both (in the case of the OpenAL and SDL frameworks)

"When you dream, there are no rules..."
Quote this message in a reply
floxwoop
Unregistered
 
Post: #3
1. I'm probably stupid, but I can't get it to work. I choose get info on the project, go to the "Build"-tab and change "Architecture" to "ppc" but it still fails to build. Why?

2. Looks like it is working (downloading and compiling right now). Do I simply replace the SDL.framework with the UB version?

Edit: Every library except SDL downloaded and compiled successfully, seems like "http://www.libsdl.org/cvs/SDL.dmg" isn't working... Anyone got a universal SDL.framework to send me?
Quote this message in a reply
floxwoop
Unregistered
 
Post: #4
Ignore my post above, I managed to compile the framework myself (thanks to the xcode project that came with the SDL source).

Thank you for helping me to find out what was wrong! Smile
Quote this message in a reply
Post Reply