Hello,
the problem is that whenever I try to open and display an image, it says it failed to open the image and also crashes due to access violation errors. Note that SFML just works properly without the image loading and displaying part. My source code:
#include "stdafx.h"
#include <SFML/Graphics.hpp>
int main()
{
sf::RenderWindow window(sf::VideoMode(300, 200), "SFML works!");
sf::Text text("Hello SFML");
sf::Texture texture;
if (!texture.loadFromFile("image.jpg"))
return EXIT_FAILURE;
sf::Sprite sprite(texture);
while (window.isOpen())
{
sf::Event event;
while (window.pollEvent(event))
{
if (event.type == sf::Event::Closed)
window.close();
}
window.clear();
window.draw(text);
window.display();
}
return 0;
}
My image.jpg is located in the same folder as the executable. I also tried using a full path but that didn't work out either. So whenever I try to run this I get these errors:
Thanks in advance