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

Author Topic: Undefined Reference Error  (Read 1083 times)

0 Members and 1 Guest are viewing this topic.

Birdron

  • Newbie
  • *
  • Posts: 17
    • View Profile
Undefined Reference Error
« on: October 03, 2023, 08:47:44 am »
I just compiled SFML using cmake. And it only build static lib I think. I have attached the image of the build. Now when I try to compile hello world it says -
(click to show/hide)
Prebuild SFML is also showing same error. Version 2.6.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
Re: Undefined Reference Error
« Reply #1 on: October 03, 2023, 09:07:28 pm »
Are you linking SFML? And have you defined SFML_STATIC?
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Birdron

  • Newbie
  • *
  • Posts: 17
    • View Profile
Re: Undefined Reference Error
« Reply #2 on: October 03, 2023, 10:18:20 pm »
Yes, I have linked sfml and defined SFML_STATIC. It was actually gcc version problem, I think. When I used prebuilt library of 2.6, it compiled without any error but when I run the app I get:- "libgcc_s_seh-1.dll not found" error. When I compiled sfml with tdm-gcc 10 I got this undefined reference error. So I removed tdm-gcc and downloaded codeblock with compiler and downloaded sfml 2.5. Now it is working without error.
« Last Edit: October 03, 2023, 10:20:29 pm by Birdron »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
Re: Undefined Reference Error
« Reply #3 on: November 11, 2023, 11:04:14 am »
TDM links the runtime library statically by default, which other MinGW distribution link them dynamically (matching the default behavior of GCC or Clang anywhere else).

If you want to link the runtime libraries statically, you have to rebuild SFML with SFML_USE_STATIC_STD_LIBS enabled.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/