我正在学习SFML库,我从教程中选择了一个代码。它会打开一个窗口,它应该让我能够再次关闭它,但是当我关闭它,它说SFML库:奇怪的错误
Debug Error!
Run-Time Check Failure #2 - stack around variable 'App' was corrupted.
and then the console stops working.
this is my code:
int main()
{
// Create the main window
sf::Window App(sf::VideoMode(800, 600, 32), "SFML Events");
while (App.IsOpened())
{
// Process events
sf::Event Event;
while (App.GetEvent(Event))
{
// Close window : exit
if (Event.Type == sf::Event::Closed)
App.Close();
// Escape key : exit
if ((Event.Type == sf::Event::KeyPressed) && (Event.Key.Code == sf::Key::Escape))
App.Close();
}
// Display window on screen
App.Display();
}
return EXIT_SUCCESS;// = return 0
}
链接到调试库的
sfml-system.lib
sfml-window.lib
sfml-system-d.lib//these are debug files
sfml-window-d.lib
如果我ramove第2和建立了我的程序它不会给出错误,但当我打开它说:
该应用程序无法正确启动(0xc0150002)。点击确定关闭应用程序
我有一台64位计算机。并在微软vC++ 2010我可以做生成解决方案或调试,我总是做生成解决方案。
和我建立在释放模式,但我也曾经尝试都和他们都没有工作
可能有人请告诉我,我可以做些什么来防止这种情况的发生或这如何。
如果您构建一个调试版本,为什么不在调试器中运行它?至少你会看到_where_问题是。 –
@JoachimPileborg先生,我已经尝试过但没有工作 –
此外,你真的应该叫'App.Display' _all the time_?在大多数其他框架中,您在进入主事件循环之前告诉应用程序对象显示_once_。另外,它会不会尝试在关闭后再次显示窗口,从而给您提供问题? –