我正在學習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_。另外,它會不會嘗試在關閉後再次顯示窗口,從而給您提供問題? –