I just found this channel today and I am blown away by how fantastic it is!!! If you have time, could you also please do a video on how to install SFML with CMake using CLion on a Mac? I know some of my classmates were struggling with that and I bet it would be a popular addition.
You're a legend mate, thanks for this! i came across this video after a last-ditch search for a solution to the error that comes from not setting a runpath.
i encountered this error when I run make -j 8 In file included from /Users/afkari/sfml/src/SFML/Graphics/Font.cpp:38: /Library/Frameworks/Mono.framework/Headers/ft2build.h:56:10: fatal error: 'freetype/config/ftheader.h' file not found #include Can you please help? (I have an assignment due this sunday and I can't do it without running sfml on Mac
@@MikeShah I’m still getting the error. This is what the second part says: make[2]: *** [src/SFML/Graphics/CMakeFiles/sfml-graphics.dir/Font.cpp.o] Error 1 make[2]: *** Waiting for unfinished jobs.... make[1]: *** [src/SFML/Graphics/CMakeFiles/sfml-graphics.dir/all] Error 2 make: *** [all] Error 2
At minute 11:00 you are getting the error causing by the version. I get a different error where it says, that there is no matching constructor for video mode. I also don't have the dylib files, when I build with make. Is there a newer version or am I missing something? Thanks for your help. Lesson number 3 worked perfectly for me 😄
hi Mike I recently came across your video and I was building sfml on my Mac M2 but when I ran the code we copied from the example I got the error that the window.clear() and window.draw(shape) functions are not members of the window class. When I went and checked the documentation for sfml 2.6.1 it turned out that it was true! Should I try installing version 2.5.1 to get it working or is there a solution while using 2.6.1. Any help would be greatly appreciated
@@MikeShah main.cpp:14:5: warning: ignoring return value of function declared with 'nodiscard' attribute [-Wunused-result] Window.setActive(); ^~~~~~~~~~~~~~~~ 1 warning generated. ld: library 'sfml-graphics' not found clang: error: linker command failed with exit code 1 (use -v to see invocation) I'm getting this error even though I'm using this: g++ -std=c++17 main.cpp -o prog -I/Users/afkari/SFML/include -L/Users/afkari/SFML/build/lib -lsfml-graphics -lsfml-window -lsfml-system Would you be able to shed some light on the prob please🙏🙏
@@MikeShah ld: library 'sfml-graphics' not found clang: error: linker command failed with exit code 1 (use -v to see invocation) I used: g++ -std=c++17 main.cpp -o prog -I/Users/afkari/sfml/include -L/Users/afkari/sfml/build/lib -lsfml-graphics -lsfml-window -lsfml-system until then can you shed some light on this please?
this must be a Mac issue but when trying to open the built app I get these pop ups > “libsfml-graphics.2.6.1.dylib” can’t be opened because Apple cannot check it for malicious software. And the app doesn't open
When I try to use SFML functions inside a file containing main function, they run fine, but when I use the functions inside a custom header&source file, it shows "symbol(s) not found for architecture arm64" , "linker command filed", please help!!
Probably need to make sure you're incluiding the header file when building those files -- I'm guessing you're building those files separately or through some makefile in which you are not linking the libraries.
@MikeShah yes you are correct, I was building them separately hence I got those errors, upon compiling and linking them together, it works perfectly fine. Thanks for your help!!
Hey mike, can u make a video about "building gcc from source in m1 mac" , the reason is: brew changes the permission to root admin where it lives which definitely can trigger security flaws.
I tried configuring into XCode instead and got the following error --> CMake Error at CMakeLists.txt:18 (project): No CMAKE_CXX_COMPILER could be found.
Can you provide some more information? I am assuming you are on a M1 Mac? Wireless keyboard? QWERTY keyboard? Some more information here: developer.apple.com/forums/thread/130787
Hi love the videos, just wondering if you could help me solve this issue. error: no matching constructor for initialization of 'sf::VideoMode' sf::RenderWindow window(sf::VideoMode(200, 200), "SFML works!"); SFML/include/SFML/Window/VideoMode.hpp:61:14: note: candidate constructor not viable: no known conversion from 'int' to 'const sf::Vector2u' (aka 'const Vector2') for 1st argument explicit VideoMode(const Vector2u& modeSize, unsigned int modeBitsPerPixel = 32); ^ SFML/include/SFML/Window/VideoMode.hpp:42:23: note: candidate constructor (the implicit copy constructor) not viable: requires 1 argument, but 2 were provided class SFML_WINDOW_API VideoMode ^ SFML/include/SFML/Window/VideoMode.hpp:42:23: note: candidate constructor (the implicit move constructor) not viable: requires 1 argument, but 2 were provided SFML/include/SFML/Window/VideoMode.hpp:52:5: note: candidate constructor not viable: requires 0 arguments, but 2 were provided VideoMode(); ^ 1 error generated. Running on Apple M1
Not sure if you're still having this issue, but I got around the same problem by explicitly passing a Vector2u instead of ints: #include ... sf::Window window(sf::VideoMode(sf::Vector2u(800, 600)), "My window"); I don't know enough to know if there's something I should do to make the old way work or if the implementation changed and it requires Vector2u now
@@foxy8490 I have the same issue but I don't know what I do, I change the file vim sgml.cpp ,but don't recognize #include I so confusing. thanks for you help.
Hi, say I have installed SFML on my Mac (with M1) using brew, and now I would like to create a new project while working with CMake. Is there a way to configure everything I need for my project by creating a CMakeLists.txt in the project home directory (without configuring anything using the cmake gui)? I am asking because I followed you other video on installing SFML with brew but tried to add the `include` and `lib` dirs paths into my CMakeLists.txt file and I still get this `fatal error: 'SFML/Graphics.hpp' file not found #include ` error. Is there a way to solve this through the project CMakeLists.txt itself? thank you!
I just found this channel today and I am blown away by how fantastic it is!!! If you have time, could you also please do a video on how to install SFML with CMake using CLion on a Mac? I know some of my classmates were struggling with that and I bet it would be a popular addition.
Cheers, thank you for the kind words! I'll consider doing something with CMake at some point.
@@MikeShah Also, reading your teaching statement made me want to be a better person. Wow!
@@ElizabethMarieKallman Thank you for the kind words -- wow! 🙂
You're a legend mate, thanks for this! i came across this video after a last-ditch search for a solution to the error that comes from not setting a runpath.
Thank you for the kind words 🙂
i encountered this error when I run make -j 8
In file included from /Users/afkari/sfml/src/SFML/Graphics/Font.cpp:38:
/Library/Frameworks/Mono.framework/Headers/ft2build.h:56:10: fatal error: 'freetype/config/ftheader.h' file not found
#include
Can you please help? (I have an assignment due this sunday and I can't do it without running sfml on Mac
Probably need to install the freetype dev libraries
@@MikeShah how would I do that any code to run on terminal?
@@Afkari7 try with 'brew install freetype'. Not sure offhand
@@MikeShah I’m still getting the error.
This is what the second part says:
make[2]: *** [src/SFML/Graphics/CMakeFiles/sfml-graphics.dir/Font.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [src/SFML/Graphics/CMakeFiles/sfml-graphics.dir/all] Error 2
make: *** [all] Error 2
At minute 11:00 you are getting the error causing by the version. I get a different error where it says, that there is no matching constructor for video mode. I also don't have the dylib files, when I build with make. Is there a newer version or am I missing something? Thanks for your help. Lesson number 3 worked perfectly for me 😄
I'm building with sfml 2.5.1 -- glad it worked for you!
hi Mike I recently came across your video and I was building sfml on my Mac M2 but when I ran the code we copied from the example I got the error that the window.clear() and window.draw(shape) functions are not members of the window class. When I went and checked the documentation for sfml 2.6.1 it turned out that it was true! Should I try installing version 2.5.1 to get it working or is there a solution while using 2.6.1. Any help would be greatly appreciated
I think this might be an issue with the update that some things changed -- so perhaps it's time for an update :)
@@MikeShah do you think you'll upload a video soon I was working on a project and I would really appreciate it if you would make a how-to video🙏🙏
@@Cbeginner007 It might be a bit before I do sfml videos, working on other series currently, then will revisit
@@MikeShah main.cpp:14:5: warning: ignoring return value of function declared with 'nodiscard' attribute [-Wunused-result]
Window.setActive();
^~~~~~~~~~~~~~~~
1 warning generated.
ld: library 'sfml-graphics' not found
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I'm getting this error even though I'm using this: g++ -std=c++17 main.cpp -o prog -I/Users/afkari/SFML/include -L/Users/afkari/SFML/build/lib -lsfml-graphics -lsfml-window -lsfml-system
Would you be able to shed some light on the prob please🙏🙏
@@MikeShah ld: library 'sfml-graphics' not found
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I used: g++ -std=c++17 main.cpp -o prog -I/Users/afkari/sfml/include -L/Users/afkari/sfml/build/lib -lsfml-graphics -lsfml-window -lsfml-system
until then can you shed some light on this please?
this must be a Mac issue but when trying to open the built app I get these pop ups > “libsfml-graphics.2.6.1.dylib” can’t be opened because Apple cannot check it for malicious software.
And the app doesn't open
Tey finding the file and opening it manually to verify it is not malicious -- I think this has to be done one time
thanks!
Cheers!
Not all heroes wear capes
Thank you for the kind words!
Thank you so much!
You are most welcome!
When I try to use SFML functions inside a file containing main function, they run fine, but when I use the functions inside a custom header&source file, it shows "symbol(s) not found for architecture arm64" , "linker command filed",
please help!!
Probably need to make sure you're incluiding the header file when building those files -- I'm guessing you're building those files separately or through some makefile in which you are not linking the libraries.
@MikeShah
yes you are correct, I was building them separately hence I got those errors, upon compiling and linking them together, it works perfectly fine. Thanks for your help!!
Hey mike, can u make a video about "building gcc from source in m1 mac" , the reason is: brew changes the permission to root admin where it lives which definitely can trigger security flaws.
That's a good idea :)
Looking forward to learning more from you.
@@ExGamified Cheers!
got error main.cpp:5:29: error: no matching constructor for initialization of 'sf::VideoMode'
g++ -std=c++17 main.cpp -o prog -I/Users/zhanrong/Documents/projects/sfml/sfml_from_source/SFML/include -L /Users/zhanrong/Documents/projects/sfml/sfml_from_source/build/lib -lsfml-graphics -lsfml-window -lsfml-system
why doesn't this work
I tried configuring into XCode instead and got the following error -->
CMake Error at CMakeLists.txt:18 (project):
No CMAKE_CXX_COMPILER could be found.
It worked for me with clang but not with g++ ;(
clang++ is the default compiler on Mac for folks, so using clang++ should be fine :)
Hey man im getting an "We have a keyboard with no keys(1) error."
Can you provide some more information? I am assuming you are on a M1 Mac? Wireless keyboard? QWERTY keyboard? Some more information here: developer.apple.com/forums/thread/130787
i can't even install cmake gui on mac....
Try either from brew or the install from cmake.org/install/
Hi love the videos, just wondering if you could help me solve this issue.
error: no matching constructor for initialization of 'sf::VideoMode'
sf::RenderWindow window(sf::VideoMode(200, 200), "SFML works!");
SFML/include/SFML/Window/VideoMode.hpp:61:14: note: candidate constructor not viable: no known conversion from 'int' to 'const sf::Vector2u' (aka 'const Vector2') for 1st argument
explicit VideoMode(const Vector2u& modeSize, unsigned int modeBitsPerPixel = 32);
^
SFML/include/SFML/Window/VideoMode.hpp:42:23: note: candidate constructor (the implicit copy constructor) not viable: requires 1 argument, but 2 were provided
class SFML_WINDOW_API VideoMode
^
SFML/include/SFML/Window/VideoMode.hpp:42:23: note: candidate constructor (the implicit move constructor) not viable: requires 1 argument, but 2 were provided
SFML/include/SFML/Window/VideoMode.hpp:52:5: note: candidate constructor not viable: requires 0 arguments, but 2 were provided
VideoMode();
^
1 error generated.
Running on Apple M1
Looks like the video mode needs explicitly the width and height: www.sfml-dev.org/documentation/2.5.1/classsf_1_1VideoMode.php
Not sure if you're still having this issue, but I got around the same problem by explicitly passing a Vector2u instead of ints:
#include
...
sf::Window window(sf::VideoMode(sf::Vector2u(800, 600)), "My window");
I don't know enough to know if there's something I should do to make the old way work or if the implementation changed and it requires Vector2u now
@@foxy8490 I have the same issue but I don't know what I do, I change the file vim sgml.cpp ,but don't recognize #include I so confusing. thanks for you help.
@@foxy8490 thank you so much for sharing. i also had this problem, now it works!
Hi, say I have installed SFML on my Mac (with M1) using brew, and now I would like to create a new project while working with CMake. Is there a way to configure everything I need for my project by creating a CMakeLists.txt in the project home directory (without configuring anything using the cmake gui)? I am asking because I followed you other video on installing SFML with brew but tried to add the `include` and `lib` dirs paths into my CMakeLists.txt file and I still get this `fatal error: 'SFML/Graphics.hpp' file not found #include ` error. Is there a way to solve this through the project CMakeLists.txt itself? thank you!
cmake does have some primitives for this (e.g. FIND_PACKAGE(SFML)), but I have not setup sfml with cmake.
@@MikeShah I see, thanks anyway, the videos are great!
Cheers@@elkabetzroy
freetype/config/ftheader.h'
This file is not found.
Might need to install the freetype library (installing through brew might work)