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

Author Topic: Drawing string with SFML 2.0  (Read 1468 times)

0 Members and 1 Guest are viewing this topic.

Stanislav

  • Newbie
  • *
  • Posts: 5
    • View Profile
    • Email
Drawing string with SFML 2.0
« on: January 28, 2013, 03:40:55 pm »
sfml::Font font;
font.loadFromFile("C:\\WINDOWS\\Fonts\\Arial.ttf");
sfml::Text text;
text.setFont(font);
text.setCharacterSize(30);
text.setStyle(sfml::Text::Bold);
text.setColor(sfml::Color::Blue);
text.setString("example");
window.draw(text);
 

I'm getting the following error:
C:\DOCUME~1\STANIS~1\LOCALS~1\Temp\ccFZolgr.o:main.cpp:(.text+0x476d): undefined
 reference to `__imp___ZN2sf6StringC1ERKSsRKSt6locale'
collect2.exe: error: ld returned 1 exit status


If i comment the setString() line it compiles without any errors. What's the problem?

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10989
    • View Profile
    • development blog
    • Email
Re: Drawing string with SFML 2.0
« Reply #1 on: January 28, 2013, 03:46:03 pm »
You should've read this post.

What exacte SFML version? Which OS? Which compiler? How did you set it up? Were you following 1:1 the official tutorial? etc etc ;)

If you want to link statically you'll have to define SFML_STATIC and use the libs with the -s suffix.
If you want to link dynamically you should not define SFML_STATIC and use the libs without suffix (except the -d for debug mode).
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: Drawing string with SFML 2.0
« Reply #2 on: January 28, 2013, 03:48:45 pm »
Don't forget to link to sfml-system.
Laurent Gomila - SFML developer

Stanislav

  • Newbie
  • *
  • Posts: 5
    • View Profile
    • Email
Re: Drawing string with SFML 2.0
« Reply #3 on: January 28, 2013, 04:02:32 pm »
Don't forget to link to sfml-system.
Thanks. It works fine now.

 

anything