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

Author Topic: Image.loadFromFile() not defined, other functions work fine. Linking problem?  (Read 2376 times)

0 Members and 1 Guest are viewing this topic.

kingkoronov

  • Newbie
  • *
  • Posts: 1
    • View Profile
I'm trying to learn OpenGL and want to use SFML for window creation, input, texture loading, etc. I've been following the tutorial at https://open.gl/textures to try and get everything to run. When I try to include the SFML.Graphics.hpp header, create an sf::Image and call loadFromFile() on that image, it claims that it is an undefined reference. What's perplexing is that calling other functions on the sf::Image object doesn't crash the program. I would just try a different image library but this seems to be suggesting that something is wrong with my setup, although I can't find anything? Can anyone help narrow down the possibilities of what might be wrong?
undefined reference to `_imp___ZN2sf5Image12loadFromFileERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE'
 

Mr_Blame

  • Full Member
  • ***
  • Posts: 192
    • View Profile
    • Email
Which IDE are you using?

It appears to be a linking problem. Can you show configuration of your project?
« Last Edit: July 13, 2017, 02:41:33 pm by Mr_Blame »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11033
    • View Profile
    • development blog
    • Email
It's an issue with the runtime library using a different string ABI (C++11 vs no C++11).
Easiest solution is to rebuild SFML with your compiler and the same settings.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/