SFML community forums
Help => General => Topic started by: andrei186 on December 12, 2021, 04:48:52 pm
-
I set up CodeBlocks with SFML to use dynamic libraries. After building and running HallowWord it created bin folder with debug folder in it, but no release folder - should it be like that?
Although from IDE it runs OK, but the exe file genereated in bin/debug keeps saying that libstdc++-6.dll and
libgcc_s_seh-1.dll are not found - is this normal?
-
It will also create a release folder once you create a release build.
The mentioned DLLs are provided by MinGW and are needed to run the application.
When you execute the application from within the IDE, it will load them automatically.
But to run it manually, you'll need to find the MinGW folder and copy them from the bin directory.
-
Thank you.
If I build it in static mode, will it work on its own?
-
If you build SFML with SFML_USE_STATIC_STD_LIBS enabled and use the -static linker command for your own code, then you won't need the two DLLs, but you'll have to specify all SFML dependencies.
Personally, I recommend to stick with your currently working setup and get some more into SFML, before changing things and spending a lot of time, getting the setup right. ;)
-
thank you. I will follow your advice
-
I had all kinds of issues with this, I got past the stage of libstdc++-6.dll and libgcc_s_seh-1.dll are not found and then got stuck on libwinpthread-1.dll not found.
In the end this is what worked for me, and I managed to compile it using Notepad++ using NPPExec as follows:
NPP_SAVE
CD $(CURRENT_DIRECTORY)
cmd /c C:\mingw64\bin\g++ -c "$(FILE_NAME)" -I"C:\SFML-2.6.2\include" -DSFML_STATIC
cmd /c C:\mingw64\bin\g++ "$(NAME_PART)".o -L"C:\SFML-2.6.2\lib" -lsfml-graphics-s -lsfml-window-s -lsfml-system-s -lopengl32 -lwinmm -lgdi32 -static-libgcc -static-libstdc++ -Wl,-Bstatic -lstdc++ -lpthread -Wl,-Bdynamic -o "$(NAME_PART)".exe
cmd /k "$(NAME_PART)"
For those of you who aren't fans of Notepad++ ;D ;D here it is, I had to compile it first and then link it separately nothing else worked on Windows. But it works now and I'm very pleased with the result 8)
C:\mingw64\bin\g++ -c main.cpp -I"C:\SFML-2.6.2\include" -DSFML_STATIC
C:\mingw64\bin\g++ main.o -L"C:\SFML-2.6.2\lib" -lsfml-graphics-s -lsfml-window-s -lsfml-system-s -lopengl32 -lwinmm -lgdi32 -static-libgcc -static-libstdc++ -Wl,-Bstatic -lstdc++ -lpthread -Wl,-Bdynamic -o main.exe
Also if you don't want the console window to open then add -mwindows to your linking command:
C:\mingw64\bin\g++ "SFML1".o -mwindows -L"C:\SFML-2.6.2\lib" -lsfml-graphics-s -lsfml-window-s -lsfml-system-s -lopengl32 -lwinmm -lgdi32 -static-libgcc -static-libstdc++ -Wl,-Bstatic -lstdc++ -lpthread -Wl,-Bdynamic -o "SFML1".exe
-
If you pass -static it should link all "standard" libs statically. Note though that SFML also needs to be built with SFML_USE_STATIC_STD_LIBS enabled, as you really don't want to mix runtime libraries.
The alternative if you don't want to link things statically, is to copy the referenced DLLs from the bin/ directory of your compiler (e.g. C:\mingw64\bin\libwinpthread-1.dll).