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

Author Topic: Can't load image from file in "Displaying a sprite" tutorial.  (Read 1716 times)

0 Members and 1 Guest are viewing this topic.

Mad Man

  • Newbie
  • *
  • Posts: 6
    • View Profile
    • Email
Can't load image from file in "Displaying a sprite" tutorial.
« on: January 23, 2013, 10:38:23 pm »
Hey all,

I'm having difficulty finishing the "displaying a sprite" tutorial while using VS Studio 2012. I've just copied and pasted the source code that the tutorial provides here. The project builds successfully, but no matter where I put the "sprite.tga" file in the directory, I get this error message.

"Failed to load image 'sprite.tga'. Reason: Unable to open file"

I've tried other tutorials that utilize the sfml-graphics and everything goes just fine, but if I try opening the .exe directly and not from the IDE, I get an error saying that sfml-graphics-d.dll is missing.

What am I doing wrong? Any help would be appreciated.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11035
    • View Profile
    • development blog
    • Email
Re: Can't load image from file in "Displaying a sprite" tutorial.
« Reply #1 on: January 23, 2013, 10:51:00 pm »
Where is the sprite.tga located?

VS's default working directory is next to the project file.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Mad Man

  • Newbie
  • *
  • Posts: 6
    • View Profile
    • Email
Re: Can't load image from file in "Displaying a sprite" tutorial.
« Reply #2 on: January 23, 2013, 10:59:15 pm »
I've tried putting it in the folder with the .exe, and when that failed, moved it to the folder with the .vcxproj files.
Still no dice. :(

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11035
    • View Profile
    • development blog
    • Email
Re: Can't load image from file in "Displaying a sprite" tutorial.
« Reply #3 on: January 23, 2013, 11:14:40 pm »
And the file got the right permission?

Have you tried loading a different file (e.g. a png)?
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Mad Man

  • Newbie
  • *
  • Posts: 6
    • View Profile
    • Email
Re: Can't load image from file in "Displaying a sprite" tutorial.
« Reply #4 on: January 23, 2013, 11:30:30 pm »
Oh man. I just realized I did something incredibly stupid(had file extensions hidden, so there was an extra .png).

Problem solved, and thanks for help expl0it3r. I'll try not to make another awful thread again.

 

anything