I'm trying to load a jpg image (1024x768), there's nothing wrong when I build the project in VS C++ 2005, but when I try to run it this error message shows up:
"Unhandled exception at 0x1023ee40 in first_ex.exe: 0xC0000005: Access violation reading location 0x097f1000."
This is the code I'm using:
sf::Image ImgBgr;
if (!ImgBgr.LoadFromFile("./background2.jpg"))
{
cout << "error loading image." << endl;
return EXIT_FAILURE;
}
sf::Sprite SprBgr(ImgBgr, 0, 0);
App.Draw(SprBgr);
Other images load successfully but this one won't, I've tried other image formats too but nothing works. Any idea what's wrong?
Edit: I forgot to mention that in debug mode, it shows that the problem is on the line where I call the LoadFromFile-function.