Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: CodeBlocks 20.03 & SFML 2.6.0 (seh, x64) - Problem with detecting DLL libraries  (Read 2204 times)

0 Members and 1 Guest are viewing this topic.

Zeba

  • Newbie
  • *
  • Posts: 4
    • View Profile
    • Email
When I want to build my project, I get three warnings that the system cannot detect such dlls as sfml-graphics-2.dll , sfml-window-2.dll , sfml-system-2-dll.

I followed the tutorial on the official website and determined the path to the "include" folder for the compiler and "lib" folder for the linker in Project Build Options.

I want to use SFML as a dynamic library, so for Debug, I have linked three libraries: sfml-graphics-d, sfml-windows-d, sfml-system-d and for Release, I linked the same libraries without prefixes.

Further, when building a project, I encounter the problem that the system could not find the dll files that I described above.

I read on the forum that I need to copy these dll files and paste them into the project folder, but I don't understand two things:
1. Where and what files should I insert? (I copied these dll files to my project folder once, but other errors started to occur)
2. Why copy them at all if I have already configured the path to the library in Project Build Settings?

I apologize if I raise strange questions, I'm just starting my way with SFML, and I want to figure out how to configure it correctly
« Last Edit: June 29, 2023, 09:38:10 am by Zeba »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
The tutorial also says:

Quote
Now compile the project, and if you linked to the dynamic version of SFML, don't forget to copy the SFML DLLs (they are in <sfml-install-path/bin>) to the directory where your compiled executable is.

You have to copy the DLLs next to your executable :)
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Zeba

  • Newbie
  • *
  • Posts: 4
    • View Profile
    • Email
It seems to me that I am making progress in finding a solution.

I tried to fix this problem in different versions of SFML, and this is what I got -

* 2.6.0 x64 - After I inserted all the following dll libraries into the folder with the .exe file, I received an error message that the system could not find the entry point (_ZSt28__throw_bad_array_new_lengthv) in the DLL ("sfml-graphics-2.dll "). Couldn't figure out what was wrong with it.

* 2.6.0 x32, 2.5.1 both x32 and x64 (MinGW), 2.5.1 (SJLJ) x32 - There is a different situation here, but all these SFML versions behave the same. The compiler seems to have found the missing dlls, but now it sends me this build log:

-------------- Build: Debug in NewProject (compiler: GNU GCC Compiler)---------------

g++.exe -L..\..\..\..\..\..\SFML-2.5.1\lib -o bin\Debug\NewProject.exe obj\Debug\main.o   -lsfml-graphics-d -lsfml-window-d -lsfml-system-d
C:/Program Files/CodeBlocks/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible ..\..\..\..\..\..\SFML-2.5.1\lib/libsfml-graphics-d.a when searching for -lsfml-graphics-d
C:/Program Files/CodeBlocks/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible ..\..\..\..\..\..\SFML-2.5.1\lib\libsfml-graphics-d.a when searching for -lsfml-graphics-d
C:/Program Files/CodeBlocks/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible ..\..\..\..\..\..\SFML-2.5.1\lib/libsfml-graphics-d.a when searching for -lsfml-graphics-d
C:/Program Files/CodeBlocks/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lsfml-graphics-d
C:/Program Files/CodeBlocks/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible ..\..\..\..\..\..\SFML-2.5.1\lib/libsfml-window-d.a when searching for -lsfml-window-d
C:/Program Files/CodeBlocks/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible ..\..\..\..\..\..\SFML-2.5.1\lib\libsfml-window-d.a when searching for -lsfml-window-d
C:/Program Files/CodeBlocks/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible ..\..\..\..\..\..\SFML-2.5.1\lib/libsfml-window-d.a when searching for -lsfml-window-d
C:/Program Files/CodeBlocks/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lsfml-window-d
C:/Program Files/CodeBlocks/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible ..\..\..\..\..\..\SFML-2.5.1\lib/libsfml-system-d.a when searching for -lsfml-system-d
C:/Program Files/CodeBlocks/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible ..\..\..\..\..\..\SFML-2.5.1\lib\libsfml-system-d.a when searching for -lsfml-system-d
C:/Program Files/CodeBlocks/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible ..\..\..\..\..\..\SFML-2.5.1\lib/libsfml-system-d.a when searching for -lsfml-system-d
C:/Program Files/CodeBlocks/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lsfml-system-d
collect2.exe: error: ld returned 1 exit status
Process terminated with status 1 (0 minute(s), 0 second(s))
4 error(s), 0 warning(s) (0 minute(s), 0 second(s))



The build messages say:

Id.exe | cannot find -lsfml-graphics-d
Id.exe | cannot find -lsfml-window-d
Id.exe | cannot find -lsfml-system-d
          | error: Id returned 1 exit status




I have no idea what to do next

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
Someone just reported that the MinGW pre-built binaries somehow lack the -d libraries.

I'll try and fix this as soon as possible.
In the meantime you could build from source with CMake or use the CMake template to build your project and SFML at once.

C:/Program Files/CodeBlocks/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe
Don't forget what is highlighted on the download page, the compilers have to match 100%!
If you're using the MinGW compiler that comes with Code::Blocks it won't match the provided pre-built binaries.
Download links for the specific compilers is provided on the download page.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Zeba

  • Newbie
  • *
  • Posts: 4
    • View Profile
    • Email
I changed the CodeBlocks compiler to my installed compiler in my OS - gcc 13.1.0. Also, I switched SFML to version 2.6.0 x32.
 
When I build my project, I get the same issues again as before, but with a different version of my compiler.
 
 -------------- Build: Debug in NewProject (compiler: GNU GCC Compiler)---------------

g++.exe -L..\..\..\..\..\..\SFML-2.6.0\lib -o bin\Debug\NewProject.exe obj\Debug\main.o   -lsfml-graphics -lsfml-window -lsfml-system
C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible ..\..\..\..\..\..\SFML-2.6.0\lib/libsfml-graphics.a when searching for -lsfml-graphics
...
and so on.

Now the gcc compiler versions are the same, but still nothing works. Here's what I have - https://imgur.com/a/B3XHj9L



The second option I tried is to create SFML from source code using CMake. So, first I downloaded the SFML 2.5.1 source archive and generated a build with the "Code::Blocks - MinGW Makefiles" option enabled.
The SFML build is generated successfully, but when I run the build process in CodeBlocks, I get the following errors - https://imgur.com/a/YyIdnU3

I have Windows 11 and I use the gcc compiler in the UCRT runtime. Does this somehow affect the work in general?

I'm confused  :-\
« Last Edit: June 29, 2023, 09:50:42 pm by Zeba »

Zeba

  • Newbie
  • *
  • Posts: 4
    • View Profile
    • Email
After a whole day of trying, I finally managed to do it :) Thank you very much eXpl0it3r for guiding me in the right direction !

I want to share my actions, I hope that this tutorial will also help someone.
So here's what I did to make SFML work on Windows 11 and Code::Blocks 20.03:

1) First I downloaded the latest version of the gcc compiler and MinGW for the MSCVRT runtime from WinLibs https://winlibs.com/. Previously, I had a compiler and library installed in the UCRT runtime environment.
2) Then I switched my OS compiler to it, and also switched to it in the Code::Blocks compiler settings.
3) I built SFML version 2.5.1 from source files using CMake 3.25.3.
4) Opened the SFML build in Code::Blocks and generated several configurations for it in CMake (for shared libraries enabled/disabled, both for the runtime mode and for debug mode).

Victory !
* Now you can create an empty project and connect the project compiler to the SFML source "include" folder, and the project linker to the SFML Build "lib" folder.
* You need to link the necessary libraries for debug mode and release mode.
* Copy and paste the necessary dll libraries into the project folder and create a file main.cpp.

Paste the code from the SFML website in it and build your project - and now you will see a green circle

Ha, that was really fun :) Good luck to everyone !

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
Glad to hear that you managed to get it working.

Yes, the UCRT version aren't compatible with the extlibs provided libraries (mostly freetype).

As mentioned, on the download page we link at the top to the compiler that should be used if one wants to use the pre-built binaries.

At the moment they match the latest WinLibs version, so with your current setup, you should be able to drop in the pre-built SFML 2.6.0 package - which I updated yesterday to add the missing debug libraries.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/