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

Author Topic: Can't compile when trying to render text  (Read 791 times)

0 Members and 1 Guest are viewing this topic.

Culf

  • Newbie
  • *
  • Posts: 2
    • View Profile
Can't compile when trying to render text
« on: May 29, 2024, 10:34:51 pm »
I am using this: https://github.com/SFML/cmake-sfml-project template to make my SFML project. It works fine until i try anything related to fonts and text.
When I just add the following line to my project:
sf::Font defaultFont;
I get this output:
[main] Building folder: SFMLGame all
[build] Starting build
[proc] Executing command: "C:\Program Files\CMake\bin\cmake.EXE" --build c:/Users/<myname>/Documents/GitHub/SFMLGame/build --config Debug --target all -j 14 --
[build] [  2%] Built target sfml-main
[build] [ 17%] Built target sfml-system
[build] [ 38%] Built target sfml-network
[build] [ 47%] Built target sfml-audio
[build] [ 71%] Built target sfml-window
[build] [ 98%] Built target sfml-graphics
[build] [ 99%] Linking CXX executable bin\main.exe
[build] Copy OpenAL DLL
[build] C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: _deps/sfml-src/extlibs/libs-mingw/x64/libfreetype.a(sfnt.c.obj):sfnt.c:(.text+0x5614): undefined reference to `_setjmp&#39;
[build] C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: _deps/sfml-src/extlibs/libs-mingw/x64/libfreetype.a(smooth.c.obj):smooth.c:(.text+0x77a): undefined reference to `_setjmp&#39;
[build] collect2.exe: error: ld returned 1 exit status
[build] mingw32-make[2]: *** [CMakeFiles\main.dir\build.make:122: bin/main.exe] Error 1
[build] mingw32-make[1]: *** [CMakeFiles\Makefile2:221: CMakeFiles/main.dir/all] Error 2
[build] mingw32-make: *** [Makefile:155: all] Error 2
[proc] The command: "C:\Program Files\CMake\bin\cmake.EXE" --build c:/Users/<myname>/Documents/GitHub/SFMLGame/build --config Debug --target all -j 14 -- exited with code: 2
[driver] Build completed: 00:00:00.716
[build] Build finished with exit code 2
 
I am on windows 10 and using mingw in VSCode. I have tried to solve it, but have not found a solution that works.
« Last Edit: May 29, 2024, 10:38:23 pm by Culf »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10976
    • View Profile
    • development blog
    • Email
Re: Can't compile when trying to render text
« Reply #1 on: May 29, 2024, 11:31:08 pm »
That's a known issue when using UCRT-based MinGW versions, as the pre-compiled freetype library were compiled with MSVCRT. You can either switch to a MSVCRT-based MinGW version or build SFML's dependencies with your own compiler.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Culf

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: Can't compile when trying to render text
« Reply #2 on: May 30, 2024, 12:47:46 am »
Thank you! I got it working with the MSVCRT-based MinGW version :D

 

anything