Lazy Foo' Productions

Setting up SDL 2 on XCode 15.1

Last Updated: Jan 7th, 2024

1) First thing you need to do is download SDL_image framework. You will find them on the SDL_image website, specifically on this page.
download page

2) Open up the dmg and place the .framework folder alongside your xcodproj file.

3) Now go download the source for lesson 06. Add the source files inside to your project.

By default in the tutorials, the SDL headers are included like this:

#include <SDL/SDL_image.h>

SDL on Mac OS X does things differently, so we have to include the SDL_image header like this:

#include <SDL2_image/SDL_image.h>

For SDL_tff, we include the header like this:

#include <SDL2_ttf/SDL_ttf.h>

For SDL_mixer, we include the header like this:

#include <SDL2_mixer/SDL_mixer.h>

4) Select your project and go to General -> Frameworks, Libraries, and Embedded Content -> click the plus sign to add items -> Add Other -> Add Files -> select your SDL2_image.framework (or SDL2_ttf.framework or SDL2_mixer.framework).

5) Don't forget to add the folder references for the image files for the tutorial. Now build. If there are any errors, make sure you didn't skip a step.