SFML community forums

Help => Window => Topic started by: 16bit_port on July 14, 2011, 05:17:37 pm

Title: [SOLVED] Very simple window (crashes)
Post by: 16bit_port on July 14, 2011, 05:17:37 pm
I'm using the 1.6 version and VS2010.

Code: [Select]
#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.
Title: [SOLVED] Very simple window (crashes)
Post by: Nexus on July 14, 2011, 05:30:03 pm
Why do you link both release and debug libraries? One (the correct one for your configuration) is enough, and don't forget sfml-system.
Title: [SOLVED] Very simple window (crashes)
Post by: 16bit_port on July 14, 2011, 05:43:28 pm
I linked to the system library and I still get the same crash.

Release mode :
Code: [Select]

#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

Code: [Select]

// 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
Code: [Select]

// 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.
Title: [SOLVED] Very simple window (crashes)
Post by: Nexus on July 14, 2011, 06:09:01 pm
Have you recompiled SFML? The binaries compiled with VS 2008 are not compatible with VS 2010.
Title: [SOLVED] Very simple window (crashes)
Post by: 16bit_port on July 14, 2011, 07:36:59 pm
Thank you. That did the trick.