macOS Xcode - Proper Way To #include: SDL2_Image/SDL2_Mixer/SDL2_TTF ?

Hi,

On macOS Xcode v13 we are having issues #including:

  • SDL2_Image
  • SDL2_Mixer
  • SDL2_TTF

To include SDL2 we use:
#include <SDL2/SDL.h>

What is the correct method to include the three SDL2 support libs above?

Let me know, thanks!

Jesse

The correct way to include SDL headers is:
#include “SDL.h”
#include “SDL_ttf.h”
etc.

This way, regardless of where they are installed on whatever platform, you can set your project to include them. In this case for Xcode, you’ll probably need to set the Framework header search path as well.

Hi,

Just started learning macOS/Xcode…
Do you know where in current Xcode v13 I can set the framework header search path?
Thanks!

Jesse

AFAIK this doesn’t work when using SDL from a framework, since you can’t/shouldn’t set the include path to be inside the framework. You have to do

#include <SDL2/SDL.h>

Which is the standard way for frameworks on macOS/iOS: #include <FrameworkName/Header.h>

It’s in the project build settings.