Reputation:
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
Upvotes: 3
Views: 2401
Reputation: 1956
I recently had same problem as the author @user14686569, although on newer version macOS Ventura. Due to few changes that happened to system paths, which also affected brew
, I enhanced the author's with few simple tweeks to be more up to date for building projects with SDL2 library, and even more.
install sdl2
via brew
brew install sdl2
in Xcode, go to your Project's setting into section Build Settings > Search Paths, like on screenshot.
/opt/homebrew/include
/opt/homebrew/lib
All set. Now, you should be able to find all libraries installed via brew, like following SDL2.
Upvotes: 0
Reputation: 11
You need to codesign
the Framework.(The command by the Lazy Foo may be not right).
security find-identity
codesign -f -s "XXXX Your signature" SDL2.framework
Don't forget to sign the another hidapi.framework within the ./Versions/A/Frameworks
.
codesign -display --verbose=4 SDL2.framework
Upvotes: 1
Reputation:
I have figured it out.
brew install sdl2
cmd+shift+g
type /usr/local/includeDisable Library Validations
in Signing & CapabilitiesAfter these steps code started to work for me
Upvotes: 2