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

Author Topic: Error: Could not load file  (Read 664 times)

0 Members and 1 Guest are viewing this topic.

Quinnjoseph

  • Newbie
  • *
  • Posts: 1
    • View Profile
Error: Could not load file
« on: February 19, 2025, 07:20:01 pm »
Hi all,

I am learning SFML 3.0.0 and have gotten to the point of trying to load a texture. I have placed a PNG file (the SFML logo .png) into my project folder, but when I try to run the code, it fails to load the file.

I have triple checked and my dll files are all in the correct places (-d for debug, etc). My working directory is set to $(Projectdir). I tried placing the absolute directory for the png in the code, but nothing seems to be working. I would appreciate any help for troubleshooting this. So far everything else I have tried to do has worked (opening a window, drawing shapes).

Hapax

  • Hero Member
  • *****
  • Posts: 3415
  • My number of posts is shown in hexadecimal.
    • View Profile
    • Links
Re: Error: Could not load file
« Reply #1 on: February 19, 2025, 07:26:36 pm »
It's likely that your current working directory is not the one that think is it.

First thing to try is to give an absolute path for the image.
For example, the image filename would include the drive and all of its folders from its root.

If that works, you should find out your current working directory and change it is necessary or move the image.

If it does not work, your file is likely to be considered "corrupt" (or, at least, not supported) and you may need to resave it. You can use an image editor to load it and then resave it; try different file formats and/or parameters, for example.
Selba Ward -SFML drawables
Cheese Map -Drawable Layered Tile Map
Kairos -Timing Library
Grambol
 *Hapaxia Links*

 

anything