Reputation: 63
Type: Debugger
"externalConsole":true
in the launch.json
, but in vain. In fact, when I do that, an external console appears, but it seems 'bugged', since it has a blinking cursor, but when I write into it, nothing happens.Here is a screenshot of the 'bugged' external console:
https://i.sstatic.net/RkrT6.jpg
Here is my launch.json
configuration:
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "g++.exe build and debug active file",
"type": "cppdbg",
"request": "launch",
"program": "${fileDirname}\\${fileBasenameNoExtension}.exe",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": true,
"MIMode": "gdb",
"miDebuggerPath": "C:\\MinGW\\bin\\gdb.exe",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
],
"preLaunchTask": "g++.exe build active file"
}
]
}
Here is the code sample that I am trying to execute:
#include<bits/stdc++.h>
using namespace std;
int main()
{
cout << "Hello";
string name;
cin >> name;
cout << "Hello " << name;
return 0;
}
Upvotes: 5
Views: 3825
Reputation: 53
Just do "externalConsole":true in the launch.json under the .vscode in your working directory. After that an external Terminal Window will appear, enter the input after you hit STEP OVER while on CIN!
Upvotes: 4
Reputation: 63
Problem solved. I just needed to step over in VSCode debug interface so that the external console let me write in it.
Upvotes: 1