SFML community forums
Help => Graphics => Topic started 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.
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.
#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.
-
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) ;)
-
Sorry about that.
1.6, static, windows 7, and Microsoft's visual c++ compiler.
Hope that helps.
-
Microsoft's visual c++ compiler
Which version?
-
Which version?
2010
I may just try a different compiler and environment and see how that goes.
-
Visual C++ 2010 cannot use libraries that were compiled with Visual C++ 2008. So you have to recompile SFML.