SFML community forums

Help => Graphics => Topic started by: dabo on September 30, 2007, 09:36:25 pm

Title: Error loading image
Post by: dabo on September 30, 2007, 09:36:25 pm
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:

Code: [Select]
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.
Title: Error loading image
Post by: Laurent on October 01, 2007, 02:55:23 am
No idea. Maybe you can send me your source code with the guilty image, so that I can check on my computer.
Title: Error loading image
Post by: dabo on October 01, 2007, 03:32:46 pm
Quote from: "Laurent"
No idea. Maybe you can send me your source code with the guilty image, so that I can check on my computer.


I've sent you a PM with the cpp and the jpg image.
Title: Error loading image
Post by: Laurent on October 01, 2007, 04:23:14 pm
I received your files, thanks.

I currently cannot test it, but the code looks good. The only reason I see is a bad version of the DevIL DLL. Make sure you don't have an old one in your system32 folder.
Title: Error loading image
Post by: dabo on October 01, 2007, 09:01:53 pm
Quote from: "Laurent"
I received your files, thanks.

I currently cannot test it, but the code looks good. The only reason I see is a bad version of the DevIL DLL. Make sure you don't have an old one in your system32 folder.


Apparently there was an old DevIL dll in the system32 folder, because when I deleted it the project runs. Before deleting the file I was always getting a message in the console about using an old version.

Thanks a lot Laurent.
Title: Error loading image
Post by: Laurent on October 02, 2007, 03:04:41 am
Glad to see it works :)
Title: Error loading image
Post by: Srejv on October 31, 2007, 11:36:05 pm
I'm also having some Image loading troubles since I updated from SVN.

Keep getting "Failed to load image from file "tex16.jpg"."

No DevIL.dll in my system32 folder. :<
Title: Error loading image
Post by: Henrik.Flink on October 31, 2007, 11:53:16 pm
Put the DevIL.dll int the debug/release folder?
Title: Error loading image
Post by: Srejv on November 01, 2007, 01:21:43 am
Quote from: "Henrik.Flink"
Put the DevIL.dll int the debug/release folder?


Yup. Did that.
Title: Error loading image
Post by: Srejv on November 01, 2007, 02:25:37 pm
Quote from: "Srejv"
Quote from: "Henrik.Flink"
Put the DevIL.dll int the debug/release folder?


Yup. Did that.


Perhaps I forgot to mention that it still doesn't work. :/