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

Author Topic: [Solved] Problem with Image::LoadFromFile() & MSVS2010  (Read 4025 times)

0 Members and 1 Guest are viewing this topic.

chbrules

  • Newbie
  • *
  • Posts: 16
    • AOL Instant Messenger - Conrad1986
    • View Profile
[Solved] Problem with Image::LoadFromFile() & MSVS2010
« on: August 05, 2010, 03:51:21 pm »
I am using Win7 x64 Ultimate and MSVS 2010, compiling in 32-bit.

My code compiles flawlessly. I've linked the debug compile to the debug .lib's and used the debug .dll's, as well as the regular ones for the release compile.

My problem comes in when I try to use Image::LoadFromFile(). I stripped it all down and tried it as well. Cleared my builds, full rebuilds, both debug and release. Nothing.

When I go to run it I get...

Debug:
---------------------------
Neptune.exe - Application Error
---------------------------
The application was unable to start correctly (0xc0150002). Click OK to close the application.
---------------------------
OK  
---------------------------


Release:
I get a program crash, and it goes back and points to the Image::LoadFromFile() line. I can't even debug the debug version. I debug the release version and it says this about the LoadFromFile() line:

"Unhandled exception at 0x73da0149 in Neptune.exe: 0xC0000005: Access violation reading location 0x706d622e."



It's just a simple LoadFromFile() call. I'm not sure what's going on here. So I did a simple test:


Code: [Select]
#include <SFML\Graphics.hpp>

using namespace sf;

void main(){
RenderWindow App(VideoMode(1024,768), "TEST!");

Image img;
img.LoadFromFile("neon.bmp");
Sprite imgSprite(img);

while(App.IsOpened()){
//Process events
Event Event;

        while (App.GetEvent(Event))
        {
            // Close window : exit
            if (Event.Type == Event::Closed)
                App.Close();
        }

App.Draw(imgSprite);

        // Clear the screen (fill it with black color)
        App.Clear();

        // Display window contents on screen
        App.Display();

}
}



Again, the debug compile fails to start no matter how I try to run it. The release compilation crashes unexpectedly and says:

"A buffer overrun has occurred in sfml-test.exe which has corrupted the program's internal state. Press Break to debug the program or Continue to terminate the program.

For more details please see Help topic 'How to debug Buffer Overrun Issues'."

And catches on some line in gs_report.c inside the compiler.



So I'm stumped. I'm guessing there is something wrong with SFML here and not me? Maybe that, or SFML doesn't play nice with MSVS 2010 and/or Win 7?  :(

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
[Solved] Problem with Image::LoadFromFile() & MSVS2010
« Reply #1 on: August 05, 2010, 03:53:43 pm »
Have you recompiled SFML?
Laurent Gomila - SFML developer

Mindiell

  • Hero Member
  • *****
  • Posts: 1261
    • ICQ Messenger - 41484135
    • View Profile
Re: Very strange problem with Image::LoadFromFile() & MS
« Reply #2 on: August 05, 2010, 03:55:18 pm »
Quote from: "chbrules"
I'm guessing there is something wrong with SFML here and not me ?

Maybe you can try to see if your image is loaded correctly as tutorial indicate it :
Code: [Select]
if (!Image.LoadFromFile("sprite.tga"))
{
    // Error...
}


Since you use the image on the sprite without knowing if it's loaded ;)
Mindiell
----

chbrules

  • Newbie
  • *
  • Posts: 16
    • AOL Instant Messenger - Conrad1986
    • View Profile
[Solved] Problem with Image::LoadFromFile() & MSVS2010
« Reply #3 on: August 05, 2010, 04:02:24 pm »
Quote from: "Laurent"
Have you recompiled SFML?


No I have not. I will try this later today. I'm about to pass out. Thanks!

chbrules

  • Newbie
  • *
  • Posts: 16
    • AOL Instant Messenger - Conrad1986
    • View Profile
Re: Very strange problem with Image::LoadFromFile() & MS
« Reply #4 on: August 05, 2010, 04:03:30 pm »
Quote from: "Mindiell"
Quote from: "chbrules"
I'm guessing there is something wrong with SFML here and not me ?

Maybe you can try to see if your image is loaded correctly as tutorial indicate it :
Code: [Select]
if (!Image.LoadFromFile("sprite.tga"))
{
    // Error...
}


Since you use the image on the sprite without knowing if it's loaded ;)


It's definitely not that. I have that check in my actual program. This was just a quicky test. The executable is crashing when it attempts to call the function itself. I probably just have to recompile files for MSVS 2010 and Win 7.

chbrules

  • Newbie
  • *
  • Posts: 16
    • AOL Instant Messenger - Conrad1986
    • View Profile
[Solved] Problem with Image::LoadFromFile() & MSVS2010
« Reply #5 on: August 06, 2010, 04:32:35 am »
That was the solution! I just recompiled all the libs and then recompiled my program. Thanks!  :D

 

anything