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

Author Topic: Image file for sprite is failed to load? [SOLVED]  (Read 5897 times)

0 Members and 1 Guest are viewing this topic.

Nitetesi

  • Newbie
  • *
  • Posts: 9
    • View Profile
Image file for sprite is failed to load? [SOLVED]
« on: November 19, 2021, 10:32:32 am »
I am just trying to create a sprite file, i put the image file both on working and output directories.
sf::Texture texture;
texture.loadFromFile("brick.jpg");
       
sf::Sprite sprite;
sprite.setTexture(texture);
this->window->draw(sprite);
 
I am sure that the conf is alright, it works on Debug x64

Failed to load image "á±ô‼x☺brick.jpg   ☼øq$~:→7É☼m÷⌂↑³¤▼F@·¤▼FŞ'♫m÷⌂P·¤▼FÉ☺". Reason: Unable to open file
« Last Edit: November 19, 2021, 03:24:47 pm by Nitetesi »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
Re: Image file for sprite is failed to load?
« Reply #1 on: November 19, 2021, 02:36:52 pm »
You need to use release libraries (without -d suffix) when building in release mode ;)
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Nitetesi

  • Newbie
  • *
  • Posts: 9
    • View Profile
Re: Image file for sprite is failed to load?
« Reply #2 on: November 19, 2021, 03:23:36 pm »
You've probably misread my post but i did the reverse (added -d to end of the library names and it seems worked) Thank you

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
Re: Image file for sprite is failed to load? [SOLVED]
« Reply #3 on: November 19, 2021, 04:03:41 pm »
Ah, the "it works on Debug x64" threw me off, but yeah, use -d on debug and no suffix for release :)
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/