SFML community forums

Help => General => Topic started by: Girby2K11 on April 10, 2011, 09:17:53 pm

Title: Error loading sprite.
Post by: Girby2K11 on April 10, 2011, 09:17:53 pm
Hi, i am new to this forum and currently TRYING to learn SFML.

Anyway when i type in the code for loading a sprite, and then tell teh program where to find the picture sf::Image Image;
if (!Image.LoadFromFile("gun.png")) when i compile and run it says this error failed to load image "gun.png". reason unable to open file? can anyone help me with this. Thanks  :evil:
Title: Error loading sprite.
Post by: Nexus on April 10, 2011, 09:22:06 pm
The image is probably not in the executable directory or has another name.
Title: Error loading sprite.
Post by: JAssange on April 11, 2011, 03:34:25 am
The image must be in the folder with the exe or the folder you set as the working directory in your debugger's options if you specify the name without a path. It can't magically find images in your Pictures folder or that are up 3 directories.
Title: Error loading sprite.
Post by: drakelord on April 14, 2011, 07:50:46 pm
Or, if for some odd reason you need to, you can also use absolute paths.  I would highly not recommend this though.