I'm starting out in Visual C++ and I'd like to know how to keep the console window.
For instance this would be a typical "hello world" application:
int _tmain(int argc, _TCHAR* argv[])
{
cout << "Hello World";
return 0;
}
What's the line I'm missing?
Start the project with Ctrl+F5 instead of just F5.
The console window will now stay open with the Press any key to continue . . .
message after the program exits.
Note that this requires the Console (/SUBSYSTEM:CONSOLE)
linker option, which you can enable as follows:
CTRL-F5 and the subsystem hints work together; they are not separate options.
(Courtesy of DJMorreTX from http://social.msdn.microsoft.com/Forums/en-US/vcprerelease/thread/21073093-516c-49d2-81c7-d960f6dc2ac6)