SFML community forums
Help => General => Topic started 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:
-
The image is probably not in the executable directory or has another name.
-
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.
-
Or, if for some odd reason you need to, you can also use absolute paths. I would highly not recommend this though.