SFML 3.0 Texture failed to load even though the path and working directory are correct
06:51 13 Apr 2026

I am using SFML 3.0 in Visual Studio 2022. I'm trying to load a background texture for my game menu, but loadFromFile returns false and I get a 'Failed to load image' error in the console.

What i check:

  1. The Working Directory in Visual Studio is set to $(ProjectDir).

  2. The image file is located in Silent City/Silent City/photos/menu-jimi-hendrix.png

  3. The file path in the code is photos/menu-jimi-hendrix.png.

  4. I have tried both relative and absolute paths, but it still fails.

  5. The font (loaded from a similar folder structure) works fine.

  6. Log don't showing bug, just when remove .png

    My Code (Menu.cpp):

    if (!backgroundTexture.loadFromFile("photos/menu-jimi-hendrix.png"))
    {
        std::cerr << "Error: photos/menu-jimi-hendrix.png not found!" << std::endl;
    }
    backgroundSprite.setTexture(backgroundTexture);
    
c++ visual-studio-2022 sfml