I have been in a similar situation recently-
I have solved it by adding {“sudo”: true} in launch.json file under .vscode directory.
just added the following line in .vscode>launch.json
{
"version": "0.2.0",
"configurations": [
{
"other..." : "configs...",
"request": "launch",
"console": "integratedTerminal",
"args": [
"${file}"
],
"sudo": true
}
]
}
VS code version I’m using is –
Version: 1.49.1 OS: Ubuntu 16.04 LTS, 64-bit
This appears to not work on all languages. For me it worked for python 3.x Other users reported it doesn’t work for C/C++.