0

failure to run a Codeblocks binary file "Hello world.exe" properly from the Windows 10 file manager

This application (console template) "hello World" runs OK from the CodeBlocks Build and Run button. I found its bin *.exe file using file manager and double clicked it. It seems like it opens a window and closes it almost faster than the eye can see. I do not see any errors texted. Should it not run from here?

8th Sep 2016, 7:07 PM
Paul Riddoch
2 odpowiedzi
+ 1
Console applications immediately close upon reaching the end of the program. If you are on Windows, you can put: system("pause"); in the main right before return 0; to prevent that. Otherwise, you can use std::getchar(); for a similar effect (needs to #include <cstdio>).
8th Sep 2016, 7:35 PM
Zen
Zen - avatar
0
Fixed: it seems the program is running and immediately closing the window, so you cannot see anything. Add a "cin" line and it will display Hello World in a window and then wait indefinitely for a keyboard entry, then you can see the Hello World in the window
8th Sep 2016, 7:28 PM
Paul Riddoch