Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Linking libraries in MACOS  (Read 79 times)

0 Members and 1 Guest are viewing this topic.

MainisHerelol

  • Newbie
  • *
  • Posts: 1
    • View Profile
    • Email
Linking libraries in MACOS
« on: November 22, 2024, 03:36:17 pm »
PLEASE HELP
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.
« Last Edit: November 22, 2024, 03:37:53 pm by MainisHerelol »

 

anything