Hello, I'm just starting to use SFML and I wanted to start off by making a window with some background picture filling it out (I'll worry about resizing it with the window later). I've seen this method work before but for me it only displays an error on the console: Unable to open file. The image is inside the folder named images which is right beside main.cpp. (Also tried pasting a whole path to the file - doesnt work either).
#include "stdafx.h"
#include<SFML/Graphics.hpp>
#include<SFML/Window.hpp>
#include<SFML/System.hpp>
int main()
{
sf::RenderWindow window{ sf::VideoMode(800,600), "The game!" };
sf::Texture t;
t.loadFromFile("images/city.png");
sf::Sprite s(t);
while (window.isOpen())
{
sf::Event windowEvent;
while (window.pollEvent(windowEvent))
{
if (windowEvent.type == sf::Event::Closed)
window.close();
}
window.clear(sf::Color::White);
window.draw(s);
window.display();
}
return 0;
}