Today I'm trying to switch from VS2019 to VS Code while keep working with MSVC. This way I will develop in a lightweight and easier environment most of the time, and when I need advanced stuff such as seeing hot paths, I would be able to open VS2019 and do the job. Below is my launch.json configuration
"name": "debug",
"type": "cppvsdbg",
"request": "launch",
"program": "${workspaceFolder}/build/${fileBasenameNoExtension}.exe",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": false,
"preLaunchTask": "compile"
The problem is that when debugging the output from std::cout cannot be seen in any window. Setting externalConsole to true opens a new console where the results are the expected ones. Is there a way to see the output of my program without a new console? When I worked with Node some time ago I remember that console.log() was visible in the DEBUG CONSOLE window
Edit 1
I added screenshots of the bottom 4 tabs below for clarifying. As u can see DEBUG CONSOLE yeild nothing. The last image is the external console. I found that after ~ 60 secs the DEBUG CONSOLE window displays the right thing, and then I guess freezes again for another ~ 60 secs. The program should display lines in an infinite loop. The last screenshot is took in another debug session, after modifying launch.json
Edit 2
Below are 2 examples. The first one works as intended. The second one does not. In my initial program something similar to the second example was executed
#include <iostream>
using namespace std;
int main() {
std::cout << "Hello world!\n";
}
#include <iostream>
#include <Windows.h>
using namespace std;
int main() {
while(true) {
Sleep(500);
std::cout << "Hello world!\n";
}
}




