Search code examples
c++xcodemacoswarningssdl-2

SDL2 installing on xCode


I have downloaded SDL2.frameworks from https://www.libsdl.org and installed it into /Libraries/Frameworks/. Then I have pointed xcode a path of frameworks and headers in 'Build Settings', in 'General' 'Frameworks and Libraries' pointed at framework file libSDL2-2.0.0.dylib . The I type #include <SDL2/SDL.h> and try to build the project. It shows 150+ warnings, but if I try to Run the program it says that Library not loaded. Why? what is the problem? I'm using Big Sur OS picture1 build settings general


Solution

  • I have figured it out.

    1. I have installed homebrew from https://brew.sh
    2. I typed in terminal brew install sdl2
    3. Then I have showed the path of framework (in xCode select project file >> build settings >> header search paths) and using cmd+shift+g type /usr/local/include
    4. In General Frameworks & Libraries put libSDL2-2.0.0.dylib (its here /usr/local/Cellar/sdl2/2.0.14_1/lib)
    5. And most important I have checked Disable Library Validations in Signing & Capabilities

    After these steps code started to work for me