Buffer Overrun?

Here is the error i am getting:
 
A buffer overrun has occurred in SFML project.exe which has corrupted the program's internal state. Press Break to debug the program or Continue to terminate the program. 


Here is my code
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#include <SFML/Graphics.hpp>


int main(int argc, char** argv)
{
	// Create the main rendering window
    sf::RenderWindow App(sf::VideoMode(800, 600, 32), "SFML Graphics");

	//Load the sprite image from a file
	sf::Image Image;
	if( !Image.LoadFromFile("sprite.bmp") )
		return EXIT_FAILURE;

	//create the sprite
	sf::Sprite Sprite(Image);

	//Change its properties
	Sprite.SetColor(sf::Color( 0, 255, 255, 128 ) );
	Sprite.SetPosition(200.f, 100.f );
	Sprite.SetScale( 2.f, 2.f );

	//Main game loop
	while( App.IsOpened() )
	{
		//Handle Events
		sf::Event Event;
		while( App.GetEvent( Event ) )
		{
			//Close window : exit
			if( Event.Type == sf::Event::Closed )
			{
				App.Close();
			}

			//Get elapsed time
			float ElapsedTime = App.GetFrameTime();

			//Move the spire
			if( App.GetInput().IsKeyDown(sf::Key::Left) )
				Sprite.Move( -100 * ElapsedTime, 0 );

			if( App.GetInput().IsKeyDown(sf::Key::Right) )
				Sprite.Move( 100 * ElapsedTime, 0 );

			if( App.GetInput().IsKeyDown(sf::Key::Up ) )
				Sprite.Move( 0, -100 * ElapsedTime);

			if( App.GetInput().IsKeyDown(sf::Key::Down ) )
				Sprite.Move(0, 100 * ElapsedTime);

			//Rotate the sprite
			if( App.GetInput().IsKeyDown(sf::Key::Add) )
				Sprite.Rotate( -100 * ElapsedTime );
			if( App.GetInput().IsKeyDown(sf::Key::Subtract ) )
				Sprite.Rotate( +100 * ElapsedTime);

			//Display sprite in window
			App.Draw(Sprite);

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

	return EXIT_SUCCESS;
}
You're mixing Debug and Release builds of the library.

If you're building in Debug mode, you must link to the debug SFML libs (they have "-d" in the name, like "sfml-graphics-d.lib"). If you're doing a release build, you need to link to the release libs (they don't have the -d).

See this for more:

http://www.sfml-dev.org/forum/viewtopic.php?p=8324&sid=129f5db780dd9d29e605ff839a7789a3
Topic archived. No new replies allowed.