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

Author Topic: problem with closing a window  (Read 4259 times)

0 Members and 2 Guests are viewing this topic.

zethos92

  • Newbie
  • *
  • Posts: 4
    • View Profile
problem with closing a window
« 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?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
problem with closing a window
« Reply #1 on: September 05, 2009, 07:24:34 pm »
Are you mixing debug and release configurations?
Laurent Gomila - SFML developer

zethos92

  • Newbie
  • *
  • Posts: 4
    • View Profile
problem with closing a window
« Reply #2 on: September 05, 2009, 07:33:20 pm »
Hä??

Sorry I´m a newbie.

I´m using MSVC++ 2008

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
problem with closing a window
« Reply #3 on: September 05, 2009, 07:39:02 pm »
Are you linking to the SFML release libraries when you compile your application in debug mode?
Laurent Gomila - SFML developer

zethos92

  • Newbie
  • *
  • Posts: 4
    • View Profile
problem with closing a window
« Reply #4 on: September 05, 2009, 09:23:14 pm »
Yes i linked them.

Otherwise the program wouldn´t even compile

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
problem with closing a window
« Reply #5 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.
Laurent Gomila - SFML developer

zethos92

  • Newbie
  • *
  • Posts: 4
    • View Profile
problem with closing a window
« Reply #6 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

 

anything