Hi everyone,
I'm working on a C++ project using SFML (version 2.6.1) on macOS. The app works perfectly on my machine, but when I distribute it to others, it doesn't work as expected due to library linking issues. Here's the error I'm encountering:
objc[1404]: Class SFApplication is implemented in both /usr/local/Cellar/sfml/2.6.1/lib/libsfml-window.2.6.1.dylib and /Users/usernameismine/Desktop/C++ SFML game project/Bubble Popper.app/Contents/Frameworks/libsfml-window.2.6.1.dylib. One of the two will be used. Which one is undefined.
It looks like the unix exe (macos executable) is trying to load SFML from both the local installation (/usr/local/Cellar/sfml/...) and the app's bundled frameworks directory (.../Contents/Frameworks). This results in runtime conflicts.
Here’s what I’ve done:
I used g++ to compile the application.
I bundled the SFML libraries in the app package under Contents/Frameworks.
Added frameworks path in install_name_tool (@executable_name/../Frameworks) to the binary after compilation.