Search code examples
c++xcodeframeworksxcode11

Xcode framework no longer found after second build


Since I upgraded to Xcode 11 every new project I start that includes a framework can be no longer be compiled after the second build of the project.

For example including SDL2 using this command:

#include <SDL2/SDL.h> 

will result in this error:

'SDL2/SDL.h' file not found

after the project has been compiled a second time.

Projects that have been created in Xcode 10 work normal in Xcode 11. I tried changing the embedding options of the frameworks but no setting works. This error occurs in all Xcode 11 versions (0 - 2.1). I am using macOS Version 10.14.6.

Why does this happen or how can this be fixed?


Solution

  • I finally found a solution. I added the frameworks with the menu in this screenshot to my project:

    enter image description here

    In Xcode 9 and 10 this did the same as adding the framework using this menu:

    enter image description here

    But now in Xcode 11 this isn't the same anymore. Adding the framework using the first menu will copy the framework from it's original path into the build folder of the project but for some reason Xcode does not copy the Headers folder in the framework. I think this is a bug but it seems like they haven't fixed it up to Xcode version 11.2.1 at least.

    So now the solution to this problem is adding the framework using the Build Phases menu in the second picture.