# SDL + XCode ... not linking?

## Recommended Posts

JohnRaptis    188

Hi all,

First a caveat: I'm a windows programmer with only mild expertise on the mac.  I dev primarily on windows, and port to Mac.  So if you answer this question, you'll have to explain to me as if I were a child.

Now!  I recently discovered that the version of SDL that I'm using is incapable of doing fullscreen on OSX Lion.  Others say get the latest SDL, it's fixed.  So I got the latest SDL.

When I add SDL to my projects, I don't do anything special-- I grab SDL.framework, and drag it into my project, and it all "just works."

But with the most recent SDL, when I do this, it doesn't work.  The program crashes on startup with the message:

Library not loaded: @rpath/SDL.framework/Versions/A/SDL Referenced from:
/Users/USER/Desktop/*/MyApp.app/Contents/MacOS/MyApp



I have limited XCode expertise.  I have tried removing SDL completely, re-adding it, adding it manually to the copy files and link with executable steps, all with the exact same results.  One note: I do NOT have SDL installed on my system, and never have.  I've always just used a copy of SDL.framework that I keep in my personal work folder, and never had any problems before.

Can anyone tell me what I'm doing wrong?

Again, to clarify: With my older version of SDL, it all works fine (but crashes on fullscreen).  If I replace the older SDL.framework with a copy of the newer one, that's when it all goes to hell.  Theoretically, nothing should have changed, right?

Edited by JohnnyLightwave

##### Share on other sites
szymczyk    182

It sounds like you're trying to have the SDL framework copied into your game's application bundle when you build the project, but the framework isn't being copied. Since you don't have the SDL framework installed on your system, the game doesn't work because there's no SDL framework on the system. You can check to see if the SDL framework is in your game's application bundle by selecting the game in the Finder, right-clicking, and choosing Show Package Contents. The SDL framework should be under Contents > Frameworks in the application bundle.

If the SDL framework isn't in the application, you have to tell Xcode to copy it. Instructions for doing this are in the following article:

Using SDL with Xcode 4

Read the comment from Adam on Feb. 2, 2012 in the article. He has a workaround if the SDL framework isn't being copied to the application bundle.