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

Author Topic: [SOLVED] Very simple window (crashes)  (Read 4353 times)

0 Members and 1 Guest are viewing this topic.

16bit_port

  • Newbie
  • *
  • Posts: 5
    • View Profile
[SOLVED] Very simple window (crashes)
« 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.

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
[SOLVED] Very simple window (crashes)
« Reply #1 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.
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

16bit_port

  • Newbie
  • *
  • Posts: 5
    • View Profile
[SOLVED] Very simple window (crashes)
« Reply #2 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.

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
[SOLVED] Very simple window (crashes)
« Reply #3 on: July 14, 2011, 06:09:01 pm »
Have you recompiled SFML? The binaries compiled with VS 2008 are not compatible with VS 2010.
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

16bit_port

  • Newbie
  • *
  • Posts: 5
    • View Profile
[SOLVED] Very simple window (crashes)
« Reply #4 on: July 14, 2011, 07:36:59 pm »
Thank you. That did the trick.

 

anything