- #36
Mark44
Mentor
- 37,796
- 10,188
When you start the program by clicking the exe's icon, your program opens a command window, runs, and then closes that window. There are a couple of things you can do to keep that window open:MathematicalPhysicist said:@Mark44 thanks.
Btw, do you happen to know why when I am executing a source file in visual C++ 2015 community the window of the .exe file appears and disappears without me pressing any key to exit from the programme?
The Debug gives me the following lines:
'Project6.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ntdll.dll'. Symbols loaded.
'Project6.exe' (Win32): Loaded 'C:\Windows\SysWOW64\kernel32.dll'. Symbols loaded.
'Project6.exe' (Win32): Loaded 'C:\Windows\SysWOW64\KernelBase.dll'. Symbols loaded.
'Project6.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msvcp140d.dll'. Cannot find or open the PDB file.
'Project6.exe' (Win32): Loaded 'C:\Windows\SysWOW64\vcruntime140d.dll'. Cannot find or open the PDB file.
'Project6.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ucrtbased.dll'. Cannot find or open the PDB file.
'Project6.exe' (Win32): Loaded 'C:\Windows\SysWOW64\advapi32.dll'. Symbols loaded.
'Project6.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msvcrt.dll'. Symbols loaded.
'Project6.exe' (Win32): Loaded 'C:\Windows\SysWOW64\sechost.dll'. Symbols loaded.
'Project6.exe' (Win32): Loaded 'C:\Windows\SysWOW64\rpcrt4.dll'. Symbols loaded.
'Project6.exe' (Win32): Loaded 'C:\Windows\SysWOW64\sspicli.dll'. Symbols loaded.
'Project6.exe' (Win32): Loaded 'C:\Windows\SysWOW64\cryptbase.dll'. Symbols loaded.
'Project6.exe' (Win32): Loaded 'C:\Windows\SysWOW64\bcryptprimitives.dll'. Symbols loaded.
The program '[6836] Project6.exe' has exited with code 0 (0x0).
I picked an empty project file and as a source file a cpp file, what am I do wrong here that the window exits automatically without me pressing any key?
Drives me nuts...
1. Open a separate command window, and CD (change directory) to the directory that contains your executable. Then type the name of the executable, which starts to run in the command window you have opened.
2. Add in input statement at the end of your main() function, such as cin >> ch; (You need to also declare ch as type char.) The command window will stay open until you type a character, and will then close.
Edit: the above should be std::cin >> ch;
The lines you show above aren't produced by the debug window, I don't believe. They are produced by the Output window. You can ignore all of them.
Last edited: