[Compile from Source] Build and Compile SFML from source on Visual Studio with CMake on Windows 11

preview_player
Показать описание

►Lesson Description: In this lesson I teach you how to compile SFML from the github repository from source code using Visual Studio. I'll also show you how to fix some dependency errors, compilation errors, and how to link to get a hello world application running on Visual Studio.

00:00 Introduction
00:40 Visual Studio Download
1:00 CMake Download
1:20 SFML Download from github
2:40 CMake GUI to build our build file
3:50 CMake Target Project
4:40 Generating a build file
5:30 Navigating Visual Studio Project
6:00 Building the SFML webpage
7:00 Sample 'hello world' SFML code
7:30 Creating a new visual studio project
8:10 Setting up x64 build
8:55 Fixing 'include' paths in Visual Studio Project
10:00 Setting C++ Language version to C++17 or greater
10:55 Fixing Linker errors by setting up Linker path
13:07 Moving dlls into executable path
14:30 Successful application of our SFML program!
15:00 Conclusion

►Please like and subscribe to help the channel!
Рекомендации по теме
Комментарии
Автор

Right, to fix the dll issue. One, make sure its the released version from github and not the master download, so at the right side where it says "Release" - click on it and download "Source code .zip" at the bottom . Then, follow his steps as per and it should work. It needs to be the released version!!

Calk
Автор

I recommend sticking with the 2.6.x branch for now (early 2022), as the master branch is undergoing heavy changes and API breaking, so you might run into issues, broken code or other tutorials don't line up with the new APIs

darkcisum
Автор

Thanks for making and posting this video. I finally understand how to compile software from source with CMake, and how to make libraries work

charlesg.smithjr.
Автор

You are my savior, bud. Thank you so much. I finally understood how to set up libraries

dunkeshon
Автор

Finally, I spent so many hours trying to figure this out! Tysm

AwesomeCadecraft
Автор

How does one start reading the source code of a large c/c++ project like vlc, gnu projects, etc. ? How do I find the entry point ? Thanks for these videos .

semimaths
Автор

Many Thanks, Mike, this was very useful.
With regard to the .dll files, we can drop them into the same folder as the .exe, but it kind of irritates me that we then get a copy of the .dlls in each and every project. I believe we could put the .dlls in a folder somewhere and add that folder to the system path and visual studio will find them. But I feel sure there must be some way of telling Visual Studio explicitly where we've put the .dlls. Can you tell me if I'm right and if so how we'd do that?

samdavepollard
Автор

i don't have those dll libraries in my build > lib > debug
why can be that?

michaplucinski
Автор

Hello! I tried this and my program still dosn't work to visual studios not finding the file to run to there being around 150 error messages down bellow I really don't know what to do since I followed the video to completion

ThatOneGuyjurassicing
Автор

When building the SFML files after CMAKE, the dlls files are not created in the build/Debug folder. I don't know what the issue is.

MrTNVolsFan
Автор

Thank you very much for the video, I was finally able to build from master! :D

gustavohqueiroz
Автор

Video is helpful but I have concerns. I want to modify the source but whenever I modify the source that we included, nothing changes

isimbulamadmobenibulsun
Автор

Hi, please please please, make some videos on how to build projects clone from github that use cmake and makefiles on visual studio, and possibly a video on how to use cmake and SDL2, because I cant get my cmake to find my SDL2 files. Thank you, and love your work.

googleaccount
Автор

redefinition; different storage class SFML-Visual-Studio

redefinition; different storage class SFML-Visual-Studio
i got these errors while following your tutorial, would you mind helping me out? thanks

sean_
Автор

Hi Mike
I have a problem reading in betwwen the lines of a sorce code. would you please help me ?

blaisofotso
Автор

didnt work for me ive watched like 4 different tutorials and i can't get it to work

el_guay
Автор

Hello, firstly i would like say thanks to you for this very informative video. But here I'm facing some problem...

Build started...
Build started: Project: SFMLVisualStudio, Configuration: Debug x64
1>main.cpp
1>C:\Users\SHREYOS GHOSH\source\repos\SFMLVisualStudio\SFMLVisualStudio\main.cpp(5, 42): error C2440: '<function-style-cast>': cannot convert from 'initializer list' to 'sf::VideoMode'
1>C:\Users\SHREYOS GHOSH\source\repos\SFMLVisualStudio\SFMLVisualStudio\main.cpp(5, 42): message : No constructor could take the source type, or constructor overload resolution was ambiguous
1>C:\Users\SHREYOS GHOSH\source\repos\SFMLVisualStudio\SFMLVisualStudio\main.cpp(5, 42): error C2665: none of the 4 overloads could convert all the argument types
1>C:\Users\SHREYOS GHOSH\Downloads\SFML-master\include\SFML\Graphics\RenderWindow.hpp(170, 1): message : could be sf::RenderWindow &)'
1>C:\Users\SHREYOS GHOSH\Downloads\SFML-master\include\SFML\Graphics\RenderWindow.hpp(95, 5): message : or 'sf::RenderWindow::RenderWindow(sf::WindowHandle, const sf::ContextSettings &)'
1>C:\Users\SHREYOS GHOSH\source\repos\SFMLVisualStudio\SFMLVisualStudio\main.cpp(5, 28): message : 'sf::RenderWindow::RenderWindow(sf::WindowHandle, const sf::ContextSettings &)': cannot convert argument 1 from 'const char [12]' to 'sf::WindowHandle'
1>C:\Users\SHREYOS GHOSH\source\repos\SFMLVisualStudio\SFMLVisualStudio\main.cpp(5, 54): message : Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or parenthesized function-style cast
1>C:\Users\SHREYOS GHOSH\Downloads\SFML-master\include\SFML\Graphics\RenderWindow.hpp(95, 5): message : see declaration of
1>C:\Users\SHREYOS GHOSH\source\repos\SFMLVisualStudio\SFMLVisualStudio\main.cpp(5, 42): message : while trying to match the argument list '(const char [12])'
1>Done building project "SFMLVisualStudio.vcxproj" -- FAILED.
Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped

shreyosghosh
Автор

I can´t just make it work when compiling it myself. Its only working when I dowload it already compiled, even so, it only works if I use these libraries: sfml-xxx.lib
sfml-xxx-s.lib or sfml-xxx-s-d.lib are not working, I get a LNK2001 error but I can´t solve it

antonioflores
Автор

hey! Nice tutorial. But could you elaborate on why can I not even build my project? No mistakes are highlighted or shown in the output, but here is the output itself:


Build started...
Build started: Project: SFML_test, Configuration: Debug x64
1>main.cpp
1>D:\SPBU\Programming\SFML_master\sfml\include\SFML\System\Vector2.inl(291, 34): error C2370: 'sf::Vector2<T>::UnitX': redefinition; different storage class
message : see declaration of 'sf::Vector2<T>::UnitX'
1>D:\SPBU\Programming\SFML_master\sfml\include\SFML\System\Vector2.inl(294, 34): error C2370: 'sf::Vector2<T>::UnitY': redefinition; different storage class
message : see declaration of 'sf::Vector2<T>::UnitY'
1>Done building project "SFML_test.vcxproj" -- FAILED.
Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped

adam
visit shbcf.ru