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

Author Topic: Stack around the variable 'app' was corrupted  (Read 6626 times)

0 Members and 1 Guest are viewing this topic.

programmer47

  • Newbie
  • *
  • Posts: 12
    • View Profile
Stack around the variable 'app' was corrupted
« 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]

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Stack around the variable 'app' was corrupted
« Reply #1 on: September 01, 2010, 12:28:45 pm »
You must link to debug libraries (-d) in debug mode.
Laurent Gomila - SFML developer

programmer47

  • Newbie
  • *
  • Posts: 12
    • View Profile
Stack around the variable 'app' was corrupted
« Reply #2 on: September 01, 2010, 12:41:39 pm »
Thanks, it worked.  They had nothing about this in the tutorials..

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Stack around the variable 'app' was corrupted
« Reply #3 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.
Laurent Gomila - SFML developer

Gamec

  • Newbie
  • *
  • Posts: 2
    • View Profile
Stack around the variable 'app' was corrupted
« Reply #4 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.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Stack around the variable 'app' was corrupted
« Reply #5 on: June 06, 2011, 07:28:25 pm »
Which compiler? Which version of SFML?
Laurent Gomila - SFML developer

Gamec

  • Newbie
  • *
  • Posts: 2
    • View Profile
Stack around the variable 'app' was corrupted
« Reply #6 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.