SFML community forums

Help => Window => Topic started by: zethos92 on September 05, 2009, 03:16:11 pm

Title: problem with closing a window
Post by: zethos92 on September 05, 2009, 03:16:11 pm
Hi Guys,

I´ve an problem:
First the code:
Code: [Select]

#include <SFML/Window.hpp>
#include <gl/glu.h>


int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow){
    sf::Window App(sf::VideoMode(800, 600, 32), " SFML Events");
while (App.IsOpened()){
        sf::Event Event;
        while (App.GetEvent(Event))
        {
if (Event.Type == sf::Event::Closed)
App.Close();
            if ((Event.Type == sf::Event::KeyPressed) && (Event.Key.Code == sf::Key::Escape))
                App.Close();
/*if (Event.Type == sf::Event::Resized)
ReSizeGLScene(Event.Size.Width, Event.Size.Height);*/
        }
//DrawGLScene();
App.Display();
    }
    return EXIT_SUCCESS;
}


everything runs fine, but if i Close the window i´ll get this message:
Run-Time Check Failure #2 - Stack around the variable 'App' was corrupted.

what could i do to avoid this?
Title: problem with closing a window
Post by: Laurent on September 05, 2009, 07:24:34 pm
Are you mixing debug and release configurations?
Title: problem with closing a window
Post by: zethos92 on September 05, 2009, 07:33:20 pm
Hä??

Sorry I´m a newbie.

I´m using MSVC++ 2008
Title: problem with closing a window
Post by: Laurent on September 05, 2009, 07:39:02 pm
Are you linking to the SFML release libraries when you compile your application in debug mode?
Title: problem with closing a window
Post by: zethos92 on September 05, 2009, 09:23:14 pm
Yes i linked them.

Otherwise the program wouldn´t even compile
Title: problem with closing a window
Post by: Laurent on September 05, 2009, 09:57:20 pm
I mean, you should link to the SFML debug libraries, not the release ones.

This is explained in the "getting started" tutorial.
Title: problem with closing a window
Post by: zethos92 on September 05, 2009, 10:56:24 pm
oh
you mean the libaries with -d
i linked with them and now the error has gone
thanks for the help