1
votes

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

2
Have you followed the Lazy Foo tutorial? It probably includes a step that you missed - alter igel
@alterigel i did. But it shows me a new error now. SIGABRT it says that there is a reference. Ive deleted the files from the path an error was showing but still nothing helped. I don’t know. What to do. It’s been 9 hours I’m trying to solve this problem - user14686569
Please edit your question to clarify exactly what you've done (if it's still relevant; it sounds like you fixed the compilation problems) and exactly what errors you're seeing. - alter igel
i've tried to reinstall SDL2 many times. and errors are same. they are shown in screenshots - user14686569
Have you seen this Q/A? Looks like it could be the same problem - alter igel

2 Answers

1
votes

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

0
votes

You need to codesign the Framework.(The command by the Lazy Foo may be not right).

  1. Find out one's own signature:
security find-identity
  1. Sign the frameworks:
codesign -f -s "XXXX Your signature" SDL2.framework

Don't forget to sign the another hidapi.framework within the ./Versions/A/Frameworks.

  1. You can verify the signature:
codesign -display --verbose=4 SDL2.framework