SDL2 on Xcode 12


I have been trying to follow the official documentation as well as a wide-range of material on the web to simply compile a “Hello World” program using Xcode 12.

Unfortunately, I run into the issue where the compiler complains it cannot find sdl.h when importing <SDL2/sdl.h>.

I know it’s possible to pull in SDL using home-brew and then compile on the command-line. However, I want to use Xcode so that I can easily bundle SDL as part of the application. Also, since Xcode isn’t beta software – it would be useful to others to update this information in general.

Has anyone had luck with this? I’m not typically a Mac-specific developer so Xcode is a little alien to me. I’m happy to work together if anyone has ideas or suggestions.


It’s years since I had a go at SDL with Xcode (I gave up cos I couldn’t figure out how to upload the app to the MacStore and thought the sales there wouldn’t be great anyway) but all I can think is did you add all the SDL Frameworks to your project?

Thanks Sean! Yeah – adding the SDL Framework is exactly what I did as far as I know.

When I get some free time, I’ll try to put together a short video or some useful screenshots to see if anyone might have suggestions. Honestly I’m a complete novice when it comes to Xcode.

In Finder (not the command line), copy SDL2.framework to the same folder as MyProject.xcodeproj

In Xcode, in your project’s settings, under the General tab, go down to the Frameworks, Libraries, and Embedded Content section. Hit the + to add another framework, hit the Add Other... -> Add Files... button, and select your SDL2.framework

In the Build Settings tab, find the Framework Search Paths build setting, double-click the text field next to it, and add the path “$(PROJECT_DIR)” (yes, actually type $(PROJECT_DIR) ) under $(inherited)

Everything should work fine now.