Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Error loading image  (Read 6087 times)

0 Members and 1 Guest are viewing this topic.

dabo

  • Sr. Member
  • ****
  • Posts: 260
    • View Profile
    • http://www.dabostudios.net
Error loading image
« 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.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Error loading image
« Reply #1 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.
Laurent Gomila - SFML developer

dabo

  • Sr. Member
  • ****
  • Posts: 260
    • View Profile
    • http://www.dabostudios.net
Error loading image
« Reply #2 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.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Error loading image
« Reply #3 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.
Laurent Gomila - SFML developer

dabo

  • Sr. Member
  • ****
  • Posts: 260
    • View Profile
    • http://www.dabostudios.net
Error loading image
« Reply #4 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.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Error loading image
« Reply #5 on: October 02, 2007, 03:04:41 am »
Glad to see it works :)
Laurent Gomila - SFML developer

Srejv

  • Jr. Member
  • **
  • Posts: 63
    • View Profile
Error loading image
« Reply #6 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. :<

Henrik.Flink

  • Newbie
  • *
  • Posts: 21
    • View Profile
Error loading image
« Reply #7 on: October 31, 2007, 11:53:16 pm »
Put the DevIL.dll int the debug/release folder?

Srejv

  • Jr. Member
  • **
  • Posts: 63
    • View Profile
Error loading image
« Reply #8 on: November 01, 2007, 01:21:43 am »
Quote from: "Henrik.Flink"
Put the DevIL.dll int the debug/release folder?


Yup. Did that.

Srejv

  • Jr. Member
  • **
  • Posts: 63
    • View Profile
Error loading image
« Reply #9 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. :/

 

anything