Hello!
I'm having an issue with SFML & Visual Studio 2010 where when the window is closed, the application itself does not terminate. I followed the tutorial and have a basic SFML skeleton app.
#include <SFML/Window.hpp>
#include <SFML/Graphics.hpp>
int main( int argc, char *args[] )
{
sf::RenderWindow window( sf::VideoMode( 640, 480 ), "Window" );
window.setFramerateLimit( 60 );
while ( window.isOpen() ) {
sf::Event event;
while ( window.pollEvent( event ) ) {
switch ( event.type ) {
case sf::Event::Closed:
window.close();
break;
case sf::Event::KeyReleased:
if ( event.key.code == sf::Keyboard::Escape ) {
window.close();
}
break;
}
}
printf( "Loopin..\n" );
window.clear();
window.display();
}
printf( "Quittin...\n" );
return EXIT_SUCCESS;
}
When run, "Loopin..." is repeated in the console, until the window is closed. It prints "Quittin..." and then hangs until I close the console window. I'm having the same issue when compiled as a Windows application as well, although in that case there is no indication that the program is still running unless run from within VS. In the Windows App case, the program must be terminated from the Task Manager.
I've searched around quite a bit and nothing has really helped. Per some suggestions, I put in a break point to see what is executing after it is supposed to close, and as far as I can tell it's sitting in ntdll.dll doing... something.
I'm at wits end here. There are no apparent functions/methods for "quitting" SFML, it just seems like Windows doesn't want to let the app die. I've seen behavior like this in say, pyGame, where depending on how the program was run (e.g., IDLE, console, etc.) execution wouldn't terminate unless pygame.quit() was explicitly called.
In case this helps, here are the command lines being run by VS to build the program.
C++:
/I"c:\dev\sfml-2.1_vs10\include" /ZI /nologo /W3 /WX- /Od /Oy- /D "WIN32" /D "_WINDOWS" /D "_MBCS" /Gm /EHsc /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Fp"Debug\SFML_Test_vs10.pch" /Fa"Debug\" /Fo"Debug\" /Fd"Debug\vc100.pdb" /Gd /analyze- /errorReport:queue
Linker:
/OUT:"c:\dev\SFML_Test_vs10\Debug\SFML_Test_vs10.exe" /NOLOGO /LIBPATH:"c:\dev\sfml-2.1_vs10\lib" "sfml-main-d.lib" "sfml-graphics-d.lib" "sfml-window-d.lib" "sfml-system-d.lib" "kernel32.lib" "user32.lib" "gdi32.lib" "winspool.lib" "comdlg32.lib" "advapi32.lib" "shell32.lib" "ole32.lib" "oleaut32.lib" "uuid.lib" "odbc32.lib" "odbccp32.lib" /MANIFEST /ManifestFile:"*SNIP*" /ALLOWISOLATION /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /DEBUG /PDB:"*SNIP*" /SUBSYSTEM:CONSOLE /PGD:"*SNIP*" /TLBID:1 /ENTRY:"main" /DYNAMICBASE /NXCOMPAT /MACHINE:X86 /ERRORREPORT:QUEUE
Thanks in advance for any help you can offer!
EDIT: I should point out that this behavior happens when program is run outside of VS as well, in both Release and Debug configurations. So it doesn't seem to be strictly a VS thing.