SFML community forums
Help => Window => Topic started 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)
#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:
Run-Time Check Failure #2 - Stack around the variable 'app' was corrupted.
What's happened? I've got this working before...[/code]
-
You must link to debug libraries (-d) in debug mode.
-
Thanks, it worked. They had nothing about this in the tutorials..
-
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.
-
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.
-
Which compiler? Which version of SFML?
-
I'm using Visual Studio 2010 and SMFL 1.6.
edit
I'm stupid. I forgot to recompile libs. Sorry for problem.