SFML community forums

Help => Graphics => Topic started by: Henry on August 23, 2021, 12:45:03 am

Title: sf::Image loadFromFile is not working
Post by: Henry 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?
Title: Re: sf::Image loadFromFile is not working
Post by: Stauricus 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?
Title: Re: sf::Image loadFromFile is not working
Post by: eXpl0it3r 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.
Title: Re: sf::Image loadFromFile is not working
Post by: Henry 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.