SFML community forums

Help => Graphics => Topic started by: GreenBug on October 19, 2011, 07:01:58 pm

Title: An odd problem
Post by: GreenBug on October 19, 2011, 07:01:58 pm
Whenever I run my program it immediatley crashes. I have no idea why, and I get this message in the console.
 
Quote
Unhandled Exception: System.AccessViolationExeption: Attempt to read or write protected memory. This is often an indication that other memory is corrupt.
at sf.RenderTarget.Clear(RenderTarget* , Color* )
at main()
at _mainCRTStartup()


I don't think it's my code, but here it is for what it's worth.

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

int main()
{
    sf::RenderWindow App(sf::VideoMode(800, 600, 32), "Heavy");
 
    sf::Image Image;

    if (!Image.LoadFromFile("heavy.tga")) return EXIT_FAILURE;

    sf::Sprite Sprite(Image);

    Sprite.SetPosition(200.f, 100.f);
   
    while (App.IsOpened())
    {
        sf::Event Event;

        while (App.GetEvent(Event))
        {
            if (Event.Type == sf::Event::Closed)
                App.Close();
        }
       
        App.Clear();
        App.Draw(Sprite);
        App.Display();
    }

    return EXIT_SUCCESS;
}


Thanks for reading, and I hope someone knows what's wrong.
Title: An odd problem
Post by: Laurent on October 19, 2011, 07:12:52 pm
Version of SFML?
Static or dynamic libraries?
OS?
Compiler?

Don't forget the rules (http://www.sfml-dev.org/forum/viewtopic.php?p=36367#36367) ;)
Title: An odd problem
Post by: GreenBug on October 19, 2011, 09:06:59 pm
Sorry about that.

1.6, static, windows 7, and Microsoft's visual c++ compiler.

Hope that helps.
Title: An odd problem
Post by: Laurent on October 19, 2011, 09:11:09 pm
Quote
Microsoft's visual c++ compiler

Which version?
Title: An odd problem
Post by: GreenBug on October 20, 2011, 06:46:50 am
Quote
Which version?
2010

I may just try a different compiler and environment and see how that goes.
Title: An odd problem
Post by: Laurent on October 20, 2011, 07:47:11 am
Visual C++ 2010 cannot use libraries that were compiled with Visual C++ 2008. So you have to recompile SFML.