SFML community forums

Help => Window => Topic started by: programmer47 on September 01, 2010, 12:27:16 pm

Title: Stack around the variable 'app' was corrupted
Post by: programmer47 on September 01, 2010, 12:27:16 pm
I'm trying to make a program, with Box2D for the physics, and SFML for the graphics.  However, I get a runtime error after I initialize sf::Window.  Here is my source code: (I'm not including the Box2D part)
Code: [Select]

#include "SFML/System.hpp"
#include "SFML/Window.hpp"
#include "SFML/Graphics.hpp"
#include <cstdio>
int main()
{
sf::Window app(sf::VideoMode(800, 600, 32), "Box2D SFML");
                for (int32 i = 0; i < 60; ++i)
{
app.Display();
}
return 0;
}

I get this runtime error:
Code: [Select]

Run-Time Check Failure #2 - Stack around the variable 'app' was corrupted.

What's happened?  I've got this working before...[/code]
Title: Stack around the variable 'app' was corrupted
Post by: Laurent on September 01, 2010, 12:28:45 pm
You must link to debug libraries (-d) in debug mode.
Title: Stack around the variable 'app' was corrupted
Post by: programmer47 on September 01, 2010, 12:41:39 pm
Thanks, it worked.  They had nothing about this in the tutorials..
Title: Stack around the variable 'app' was corrupted
Post by: Laurent on September 01, 2010, 02:09:07 pm
Quote from: "tutorial"
Important: for the Debug configuration, you have to link with the debug versions of the libraries, which have the "-d" suffix (sfml-system-d.lib in this case). If you don't, you may get undefined behaviours and crashes.
Title: Stack around the variable 'app' was corrupted
Post by: Gamec on June 06, 2011, 07:11:57 pm
I have the same problem, but when I link to debug versions of the libraries I get "Program has stopped working" when starting program.

Debugger breaks on that line "sf::Window App(sf::VideoMode(800, 600, 32), "SFML OpenGL");".

edit
And I also get:

Unhandled exception at 0x7624f800 in shooter.exe: 0xC0000005: Access violation reading location 0x65704f20.
Title: Stack around the variable 'app' was corrupted
Post by: Laurent on June 06, 2011, 07:28:25 pm
Which compiler? Which version of SFML?
Title: Stack around the variable 'app' was corrupted
Post by: Gamec on June 06, 2011, 07:49:26 pm
I'm using Visual Studio 2010 and SMFL 1.6.

edit
I'm stupid. I forgot to recompile libs. Sorry for problem.