Did you self-build SFML using the exact same compiler you are using with Code::Blocks?
If the answer is no; then you likely will never get a good build that runs.
Edit: I just ran the CB example code using MSys2 UCRT64 and it worked for me.
NOTE: MSys2 UCRT64 does not have debug versions of the libraries.
Edit2: Attached CB Project
Edit3: Project was created using CB console Wizard; and, then I modified it till it built and ran.
I copied the main.cpp and BMP from the CB scripted wizard sfml resource folder.
Edit4: More research implies sfml-main library is only needed for static build.
Edit5: Add link https://www.sfml-dev.org/tutorials/2.6/start-cb.php (https://www.sfml-dev.org/tutorials/2.6/start-cb.php)
Edit6: Add link to updated CB Project https://github.com/stahta01/MSys2_CodeBlocks_Projects/blob/main/sfml/demo_sfml.cbp (https://github.com/stahta01/MSys2_CodeBlocks_Projects/blob/main/sfml/demo_sfml.cbp)
Edit7: Delete old attached CB Project
Edit8: Change build logs to new project.
$ pacman -Qs sfml
local/mingw-w64-ucrt-x86_64-sfml 2.6.1-1
A simple, fast, cross-platform, and object-oriented multimedia API (mingw-w64)
-------------- Build: Debug_shared in demo_sfml (compiler: GNU GCC Compiler)---------------
g++.exe -Wall -fexceptions -g -c H:\devel\cb_projects\test\testsfml\main.cpp -o obj\Debug\main.o
g++.exe -o bin\Debug\testsfml.exe obj\Debug\main.o -lsfml-window.dll -lsfml-graphics.dll -lsfml-system.dll
Output file is bin\Debug\testsfml.exe with size 366.23 KB
-------------- Build: Release_shared in demo_sfml (compiler: GNU GCC Compiler)---------------
g++.exe -Wall -fexceptions -O2 -c H:\devel\cb_projects\test\testsfml\main.cpp -o obj\Release\main.o
g++.exe -o bin\Release\testsfml.exe obj\Release\main.o -s -lsfml-window.dll -lsfml-graphics.dll -lsfml-system.dll -mwindows
Output file is bin\Release\testsfml.exe with size 21.00 KB
-------------- Build: Debug_static in demo_sfml (compiler: GNU GCC Compiler)---------------
g++.exe -Wall -fexceptions -g -DSFML_STATIC -c H:\devel\cb_projects\test\testsfml\main.cpp -o obj\Debug_static\main.o
g++.exe -o bin\Debug_static\testsfml.exe obj\Debug_static\main.o -lsfml-main -lsfml-window-s -lsfml-graphics-s -lsfml-system-s -lopengl32 -lwinmm -lgdi32
Output file is bin\Debug_static\testsfml.exe with size 1.40 MB
-------------- Build: Release_static in demo_sfml (compiler: GNU GCC Compiler)---------------
g++.exe -Wall -fexceptions -O2 -DSFML_STATIC -c H:\devel\cb_projects\test\testsfml\main.cpp -o obj\Release_static\main.o
g++.exe -o bin\Release_static\testsfml.exe obj\Release_static\main.o -lsfml-main -lsfml-window-s -lsfml-graphics-s -lsfml-system-s -lopengl32 -lwinmm -lgdi32 -mwindows
Output file is bin\Release_static\testsfml.exe with size 1.18 MB
Tim S.
Using Nightly version 13413 with the GCC 13.1.0 compiler, I downloaded the SFML-2.6.1 Binary that uses the same compiler. After unzipping the SFML binary, I created a SFML gui project in C::B. Attempting to build a Static Release, I encountered the following failure:
-------------- Clean: Release_Static in Project1 (compiler: GNU GCC 13.1.0 Mingw64 Compiler)---------------
Cleaned "Project1 - Release_Static"
-------------- Build: Release_Static in Project1 (compiler: GNU GCC 13.1.0 Mingw64 Compiler)---------------
g++.exe -Wall -fexceptions -O2 -DSFML_STATIC -IC:\sfml-gcc\include -c C:\Sandbox1\Project1\main.cpp -o .objs\main.o
g++.exe -LC:\sfml-gcc\lib -o Project1.exe .objs\main.o -lsfml-graphics-s -lsfml-window-s -lsfml-system-s -lsfml-main -lopengl32 -lwinmm -lgdi32 -mwindows
C:/Mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\sfml-gcc\lib/libsfml-system-s.a(Err.cpp.obj):Err.cpp:(.rdata+0x80): undefined reference to `std::basic_streambuf<char, std::char_traits<char> >::seekpos(std::fpos<int>, std::_Ios_Openmode)'
collect2.exe: error: ld returned 1 exit status
Process terminated with status 1 (0 minute(s), 5 second(s))
2 error(s), 0 warning(s) (0 minute(s), 5 second(s))
Any ideas of what's causing the error?