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

Author Topic: sf::Image loadFromFile is not working  (Read 4690 times)

0 Members and 1 Guest are viewing this topic.

Henry

  • Newbie
  • *
  • Posts: 4
    • View Profile
    • Email
sf::Image loadFromFile is not working
« on: August 23, 2021, 12:45:03 am »
so, i'm using code blocks 16.01 with a TDM 5.1.0 compiler with SFML version 2.5.1, i'm doing a project to convert an RGBA image to ASCII characters using SFML. I'm loading an image in by doing this:

sf::Image img;
if(!img.loadFromFile(file_path))
{
     std::cout<<"error loading image"<<std::endl;
}
 

but instead of the code outputing "error loading image", it gives me an error:

obj\Release\main.o:main.cpp:(.text.startup+0x87)||undefined reference to `sf::Image::loadFromFile(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'|
 

can anyone help?
« Last Edit: August 23, 2021, 01:37:51 am by Henry »

Stauricus

  • Sr. Member
  • ****
  • Posts: 369
    • View Profile
    • A Mafia Graphic Novel
    • Email
Re: sf::Image loadFromFile is not working
« Reply #1 on: August 23, 2021, 03:12:34 am »
are you sure you're not mixing x86 and x64 libraries?
and also not mixing debug and release libraries?
Visit my game site (and hopefully help funding it? )
Website | IndieDB

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10801
    • View Profile
    • development blog
    • Email
Re: sf::Image loadFromFile is not working
« Reply #2 on: August 24, 2021, 01:00:26 pm »
If you enable C++11 support, you may still have to rebuild SFML, because the ABI for std::string changed and SFML ends up referencing a different runtime than your own application.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Henry

  • Newbie
  • *
  • Posts: 4
    • View Profile
    • Email
Re: sf::Image loadFromFile is not working
« Reply #3 on: August 30, 2021, 02:29:11 pm »
are you sure you're not mixing x86 and x64 libraries?
and also not mixing debug and release libraries?
Yes I'm sure, I've checked all the libraries before I made the post.