I am trying to get started with SFML on my OS Mac without using Xcode and have gone through the non-IDE installation. I am following this tutorial: https://www.sfml-dev.org/tutorials/2.0/start-linux.php It is the linux install page but it seems suited for someone trying to do it on a mac OS terminal.
I have a CPP directory where I keep my example.cpp file and in that directory I have a "Resources" folder where I keep the SFML stuff. However I am getting a "Library not loaded" error on my terminal and I have searched a bit across the web and am still having quite some trouble. I have since added "freetype" on homebrew but that doesn't seem to work. I also made sure to tell the dynamic linker where to find the SMFL libraries.
el-nino:CPP Home$ g++ -std=c++11 -IResources/SFMLR/include -c example.cpp
el-nino:CPP Home$ g++ example.o -o sfml-app -LResources/SFMLR/lib -lsfml-graphics -lsfml-window -lsfml-system
el-nino:CPP Home$ ./sfml-app
dyld: Library not loaded: @rpath/../Frameworks/freetype.framework/Versions/A/freetype
Referenced from: /Users/Home/Desktop/Junk_Code/CPP/Resources/SFMLR/lib/libsfml-graphics.2.4.2.dylib
Reason: image not found
Abort trap: 6
You need to copy the content of extlibs to /Library/Frameworks
then try to build and run your app :)
For those that were interested in the SFML documentation:
Installing SFML for macOSx
Header files and libraries
SFML is available either as dylibs or as frameworks. Only one type of binary is required although both can be installed simultaneously on the same system. We recommend using the frameworks
frameworks: Copy the content of Frameworks to /Library/Frameworks.
dylib: Copy the content of lib to /usr/local/lib and copy the content of include to /usr/local/include.
SFML dependencies
SFML depends on a few external libraries on macOS. Copy the content of extlibs to /Library/Frameworks.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With