Weird Problem with XCode, SDL2, and Catalina

Using XCode 11.4, the latest SDL framework download, and MacOS Catalina on a MacBook air.

I’ve included the SDL2.framework into the project. The autocomplete in the editor finds the SDL2/sdl.h header, and the first compile works and runs. Immediately afterwards, the editor tags the #include line with “‘SDL2/sdl.h’ file not found” and it no longer builds.

If I create a new project, add the framework again and copy/paste the code, it will again build and run the first time, then fail in the same way.

Anyone know what is going on?

I am experiencing the same exact problems on Mojave and XCode 11.3

Thanks in advance.
Kendall

try this syntax; #include <SDL2/SDL.h>

Yeah ive been having the same problem as well. i found the clearing the cache with cmd + shift + k helps it build again but no permanent fix.

Since the framework is SDL2, you have to do

#include <SDL2/SDL.h>

As I expect others are still trying to understand this problem, Eric wrote some feedback a while back on this.

Now, I have been using the cmd + shift + k cache clearing method to work around this, as I have not been able to use Eric’s feedback to find a working solution. I wonder if anyone else has?

To give some idea of how annoying this problem is, I originally was working in VS Code when this issue began. Rebuilt in Eclipse and then hit the same issue… begrudgingly downloaded XCode which lead me to these forum posts and after a day of trying to tweak settings my conclusion is that I need to adjust my OS in someway. I have tried resigning the code, adjusting the hardened runtime, however I can not get a permanent fix.

I will continue working in linux in the meanwhile, but please do reply if you have this issue and have a workable solution.

All the best
Toffy

Are you specifying the folder where you put SDL2.framework in the Framework Search Paths in your build settings?

What worked for me today (after 3 hours, argh!), on macOS 13.2.1 with XCode 14.2, was to go the target build phases, delete SDL2.framework from “Embed Frameworks”, create a new “Headers” build phase, and add SDL2.framework into its “Private” section.