SFML community forums
Help => Window => Topic started by: 16bit_port on July 14, 2011, 05:17:37 pm
-
I'm using the 1.6 version and VS2010.
#include <SFML/Window.hpp>
#pragma comment( lib, "sfml-window" )
#pragma comment( lib, "sfml-window-d" )
int main()
{
sf::Window App1( sf::VideoMode(800, 600, 32), "Window 1" );
App1.Close();
return 0;
}
It crashes at exit of main() (at } ). It says "Run-Time Check Failure #2 - Stack around the variable 'App1' was corrupted."
It happens with both debug and release build.
-
Why do you link both release and debug libraries? One (the correct one for your configuration) is enough, and don't forget sfml-system.
-
I linked to the system library and I still get the same crash.
Release mode :
#include <SFML/Window.hpp>
#pragma comment( lib, "sfml-system" )
#pragma comment( lib, "sfml-window" )
int main()
{
sf::Window App1( sf::VideoMode(800, 600, 32), "Window 1" );
App1.Close();
return 0;
}
The reason why I linked both versions is because if I link just the debug libraries
// debug mode
#include <SFML/Window.hpp>
#pragma comment( lib, "sfml-system-d" )
#pragma comment( lib, "sfml-window-d" )
int main()
{
sf::Window App1( sf::VideoMode(800, 600, 32), "Window 1" );
App1.Close();
return 0;
}
I get "The application was unable to start correctly (0xc0150002). Click OK to close the application."
However, if I link both versions
// debug mode
#include <SFML/Window.hpp>
#pragma comment( lib, "sfml-system" )
#pragma comment( lib, "sfml-system-d" )
#pragma comment( lib, "sfml-window" )
#pragma comment( lib, "sfml-window-d" )
int main()
{
sf::Window App1( sf::VideoMode(800, 600, 32), "Window 1" );
App1.Close();
return 0;
}
I don't get THAT error BUT it still crashes with the message in the original post.
Also all of the dlls are in the executable directory.
-
Have you recompiled SFML? The binaries compiled with VS 2008 are not compatible with VS 2010.
-
Thank you. That did the trick.