I’m trying to #include several SDL2 frameworks for the first time. I can’t seem to get it to work.
In the past, I have always been using a single framework (e.g., the SDL2.framework), which I would copy to the same directory as my Xcode project file (as suggested by sjr), and then add the SDL2.framework manually to my Xcode project. This has consistently worked for me in the past, however I have not had to deal with any header issues.
To solve my header situation, since I only had a single set of header files that needed to be added, I would cd to the directory where my source files are, and:
ln -s …/SDL2.framework/Headers/
which will place a simlink to the proper headers at the same directory as my c/c++ source files, and then I just:
#include “Headers/SDL.h”
That has been a very reliable way to solve my header problems in the past.
As mentioned, this technique doesn’t work all that well now that I am trying to use SDL_image and SDL_ttf too. Is there a way to set things up so that:
#include <SDL2/SDL.h>
#include <SDL2/SDL_image.h>
#include <STD2/SDL_ttf.h>
…works?
I looked at SDL2 on Xcode 12 - #6 by sjr
I seem to be having the same (or a very similar problem).
So far, I have edited:
- Framework Search Paths
- Header Search Paths
- System Header Search Paths
- User Header Search Paths
I’ve tried including all 3 header locations in these 4 search paths, and I’ve also tried adding the text “$(PROJECT_DIR)” to the bottom of the list of Framework Search Paths. I’ve also tried changing all of these to “recursive” and “non-recursive” mode.
Nothing seems to work. Currently, the error I am seeing is:
#include <SDL2/SDL.h> <-----Error! SDL2/SDL.h not found
So it can’t even find the first SDL2 header (that I already fixed a long time ago by making a simlink in the same directory as my source code as mentioned above).
Is there a simple tutorial somewhere that shows how to solve the issue of #including multiple SDL2-related headers for Xcode?
Thank you!