So, I finished a game in C ++ / SFML and I would like to send it to someone but when I send it there are errors: I tested the exe on another computer with SFML DLLs required and it shows me that libstdc ++ - 6.dll is missing, so I added it and I tried again and it tells me that there are still other dll missing, it is very embarrassing. How can I share my game without all those errors and missing DLLs?
SFML is a simple to use and portable API written in C++.
Chesster, puzzle game. Cosmoscroll, free open-source space-based shoot 'em up game. Crea, moddable 2D sandbox game. Extreme Tux Racer, free open-source arctic racing game featuring Tux (using SFML since version 0.7).
Simple and Fast Multimedia LibraryIt is composed of five modules: system, window, graphics, audio and network.
You could use Dependency Walker (depends.exe) to find all the dll-s your application is using. It will still require some trial and error cycles to discover the ones you need, but at least you have somewhere to start from. You will most likely need the dlls provided by the compiler and the dlls of additional libraries you are using. You will most likely not need anything from the System32 folder.
If you're planning on deploying an SFML application, statically building your project is recommended. This requires also statically building SFML. It takes a little time to setup, but all dependencies will be included in your executable making your application much more reliable and easier to install. This process is not to be confused with statically linking to SFML, which you will still need to do once you've statically build SFML.
You will have to clone the SFML repository and use CMake to generate your visual studio project that will then let you build SFML statically with /MTd for debug and /MT for release. These options can be found in Project Properties > C/C++ > Code Generation > Runtime Library
.
As @aj.toulan said, you need to Link SFML statically. I will assume you're developing on Windows using Visual Studio. When you download and setup SFML, it already has static libraries built.
If you are using any external libs you need to build a static version of them!
You need to add a pre-processor definition for SFML_STATIC in your Project Properties.
Now you need to include static libraries. Whichever SFML libraries you are using in your project but you add "-s"
Eg #pragma comment(lib,"sfml-graphics-s.lib")
SFML uses openal32.lib and due to licensing, you will need to have that DLL in the folder with your exe
#ifndef SFML_STATIC
#pragma comment(lib,"sfml-graphics-s.lib")
#pragma comment(lib,"freetype.lib")
#pragma comment(lib,"opengl32.lib")
#pragma comment(lib,"sfml-system-s.lib")
#pragma comment(lib,"winmm.lib")
#pragma comment(lib,"sfml-window-s.lib")
#pragma comment(lib,"gdi32")
#pragma comment(lib,"winmm")
#pragma comment(lib,"sfml-audio-s.lib")
#pragma comment(lib,"flac.lib")
#pragma comment(lib,"ogg.lib")
#pragma comment(lib,"vorbisenc.lib")
#pragma comment(lib,"vorbisfile.lib")
#pragma comment(lib,"vorbis.lib")
#pragma comment(lib,"openal32.lib")
#pragma comment(lib,"sfml-main.lib")
#pragma comment(lib,"sfml-network-s.lib")
#pragma comment(lib,"ws2_32.lib")
#pragma comment(lib,"openal32.lib")
//include below line if you want to hide console window
#pragma comment(linker, "/SUBSYSTEM:windows /ENTRY:mainCRTStartup")
#endif // !SFML_STATIC
Link to SFML FAQ showing what you need to include for each lib when linking statically
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