none of my programs will open

with all my applications I'm trying to open they won't work. When building programs in visual studio the program compiles opens and then closes straight away, leaving no messages or anything, but its the same with other applications
and the same thing happens, I open the application and it closes straight away.

I've updated all drivers on my laptop so not sure where the problem could be.
any help would be appreciated.
Last edited on
Are you writing console applications? If so, the console will close as soon as the program is run so if you want to take a look at your output you could add something like the following to the end of your program:

char c;
cin >> c;

This will force the console to remain open (in order to read in the char c) and allow you to read the output of the program. Once you press 'enter', the console will then close.
Last edited on
Ogoyant's suggestion will work. But I think its easier if you just use a break point.

Just click on the side bar like this

And a red ball will appear. When the compiler gets to there, it will stop at that line. Leaving the console open.

I always put them at my return 0 at the end the program.
The breakpoint is definitely more efficient if all you want is to check that the program works as it's supposed to be and provides the appropriate output.

But it's not part of the written program itself, it only stops program execution at the designated line of code while debugging it inside Visual Studio. So if Gaskell1992 wants the program to leave the console open for inspecting output even outside Visual Studio, he will have to use something different than a breakpoint.
Topic archived. No new replies allowed.