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

Author Topic: App crashed on Window::Close()  (Read 1920 times)

0 Members and 1 Guest are viewing this topic.

Prominence256

  • Newbie
  • *
  • Posts: 24
    • View Profile
    • http://GameMakerStation.110mb.com/
App crashed on Window::Close()
« on: December 21, 2010, 08:44:25 pm »
I just started with SFML 1.6 and I'm trying to go through the official tutorials. I'm currently on the window-events one. I'm using Visual Studio 2010, and my problem is that my program crashes when it's told to close. VS gives me the error:
Quote from: "Visual Studio"
Run-Time Check Failure #2 - Stack around the variable 'app' was corrupted.
This is my code:
Code: [Select]
int main(int argc, char** argv)
{
Window app(VideoMode(768, 512, 32), "SFML Window");
const Input& input = app.GetInput();

while (app.IsOpened())
{
Event events;
while (app.GetEvent(events))
{
if ((events.Type == Event::Closed) || // X is clicked
((events.Type == Event::KeyReleased) && (events.Key.Code == Key::Escape))) // Esc is released
app.Close();
}

// Arrow Keys
bool LeftKeyDown = input.IsKeyDown(Key::Left);
bool RightKeyDown = input.IsKeyDown(Key::Right);
bool UpKeyDown = input.IsKeyDown(Key::Up);
bool DownKeyDown = input.IsKeyDown(Key::Down);
// Mouse
bool LeftDown = input.IsMouseButtonDown(Mouse::Left);
bool MiddleDown = input.IsMouseButtonDown(Mouse::Middle);
bool RightDown = input.IsMouseButtonDown(Mouse::Right);
unsigned int MouseX = input.GetMouseX();
unsigned int MouseY = input.GetMouseY();

app.Display();
}
return 0;
}

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32502
    • View Profile
    • SFML's website
    • Email
App crashed on Window::Close()
« Reply #1 on: December 21, 2010, 11:52:48 pm »
Have you recompiled SFML?
Laurent Gomila - SFML developer

Prominence256

  • Newbie
  • *
  • Posts: 24
    • View Profile
    • http://GameMakerStation.110mb.com/
App crashed on Window::Close()
« Reply #2 on: December 22, 2010, 03:45:44 am »
I'm actually using the VS 2008 download.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32502
    • View Profile
    • SFML's website
    • Email
App crashed on Window::Close()
« Reply #3 on: December 22, 2010, 07:52:35 am »
So you must first recompile SFML.
Laurent Gomila - SFML developer

model76

  • Full Member
  • ***
  • Posts: 231
    • View Profile
App crashed on Window::Close()
« Reply #4 on: December 22, 2010, 02:37:54 pm »
Maybe you could provide a VS 2010 version? It seems like a fair amount of new users have this issue...

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32502
    • View Profile
    • SFML's website
    • Email
App crashed on Window::Close()
« Reply #5 on: December 22, 2010, 03:24:06 pm »
I will, for the next versions of SFML.
Laurent Gomila - SFML developer

Prominence256

  • Newbie
  • *
  • Posts: 24
    • View Profile
    • http://GameMakerStation.110mb.com/
App crashed on Window::Close()
« Reply #6 on: December 22, 2010, 11:07:38 pm »
I'm trying to use VS's batch build to recompile SFML, but when I do it doesn't create any of the regular .lib's like sfml-window.lib or sfml-system.lib

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32502
    • View Profile
    • SFML's website
    • Email
App crashed on Window::Close()
« Reply #7 on: December 23, 2010, 08:06:07 am »
The batch build is not supposed to work for VS 2010.
Laurent Gomila - SFML developer

Prominence256

  • Newbie
  • *
  • Posts: 24
    • View Profile
    • http://GameMakerStation.110mb.com/
App crashed on Window::Close()
« Reply #8 on: December 24, 2010, 10:39:22 pm »
I recompiled it all and now it's working great, thanks. :D

 

anything