c++sfml

c++ sfml writes to the console: Failed to load image "". Reason: Unable to open file


I tried to upload the image via sfml probably in all possible ways, but I got an error in the console
My code:

#include <SFML/Graphics.hpp>
#include <SFML/Window.hpp>
#include <SFML/System.hpp>
#include <iostream>
using namespace std;
int main()
{
    sf::RenderWindow window(sf::VideoMode(800, 600), "Test");
    sf::Texture texture;
    int i=0;
    if (!texture.loadFromFile("box.jpg"))
    {
        std::cout << "Error!";
        window.close();
        return 1;
    }
    
    sf::Sprite sprite;
    sprite.setTexture(texture);
    sf::Event event=sf::Event();
    while (window.isOpen())
    {   
        
        if (event.type == sf::Event::Closed)
            window.close();
        window.draw(sprite);
        window.clear();
        window.display();
    }

    return 0;
}

Maybe I'm doing something wrong, I'm a beginner c++ and sfml developer.
My settings:
https://i.sstatic.net/OF9FA.png
https://i.sstatic.net/u2ZSC.png
The file with the picture is in all folders starting from the repos

I dragged the file over all folders in the solution folder, starting from the very first folder ending with the x64 folder, all without success, I searched the question on the Internet, I did not find. \

I tried to move the image to the C folder and specified the path to the image C:\\box.jpg, I got an error in the console:Failed to load image "╨°│╕;☻C:\box.jpg ‼b√⌂Г0b√⌂9Ц ☻ў⌂ ♥X☻ ў⌂Я0b√⌂И·/WJИ·/WJ¶·/WJж╬▀pp↓ut ☻ў⌂)w ☻ў⌂☺p↓│▼√⌂╜О ☻ў⌂☺P?Ь╡;☻└ЙЪ╡;☻`t ☻ў⌂╬u ☻ў⌂Ё ☻ў⌂ Є ☻ў⌂аK♥ў⌂ИK♥ў⌂Оt ☻ў⌂╛w ☻ў⌂¶v╞р√⌂@¶WJб&╢с√⌂0√  ш♦0√  ╨♦↓


Solution

  • Who has the same problem go to the project -> properties -> configuration properties -> advanced -> use debugging libraries, by default it is yes, you need to set it to default or "no". Translated through a translator, the translation may not be accurate

    (Sorry for my English)