I'm a bit new to Visual Studio Code. I am struggling with an issue when I debug a new C++ program. When I set the compile debug configuration, I select the option for C:\msys64\ucrt64\bin\g++.exe
from the drop-down choices, as referenced in this picture:
Unfortunately, when I try to run debug, I get a a prelaunch error, which I've determined to be caused by an incorrect command argument in the newly created tasks.json
file:
{
"tasks": [
{
"type": "cppbuild",
"label": "C/C++: g++.exe build active file",
"command": "C:\\Perl64\\site\\bin\\g++.exe",
"args": [
"-fdiagnostics-color=always",
"-g",
"${file}",
"-o",
"${fileDirname}\\${fileBasenameNoExtension}.exe"
],
"options": {
"cwd": "${fileDirname}"
},
"problemMatcher": [
"$gcc"
],
"group": {
"kind": "build",
"isDefault": true
},
"detail": "Task generated by Debugger."
}
],
"version": "2.0.0"
}
I then have to manually edit/change the command argument in the tasks.json
file to read:
"command": "C:\\msys64\\ucrt64\\bin\\g++.exe"
This corrects the issue.
Why does it not pick up the correct path? What am I missing in settings to eliminate the need for manual editing?
BTW, I have included the value 'C:\msys64\ucrt64\bin'
in the PATH
system environment variable.
I was expecting not to get the prelaunch error, and I was expecting the tasks.json
command argument to have the correct path:
"command": "C:\\msys64\\ucrt64\\bin\\g++.exe"