The default generated launch.json and task.json files are below:
I don't know why there are some Chinese words. My VSCode is in English and doesn't install the language package. I think it's an another bug.
{
// 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": "gcc.exe - 生成和调试活动文件",
"type": "cppdbg",
"request": "launch",
"program": "${fileDirname}\\${fileBasenameNoExtension}.exe",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"miDebuggerPath": "C:\\ProgramData\\chocolatey\\bin\\gdb.exe",
"setupCommands": [
{
"description": "为 gdb 启用整齐打印",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
],
"preLaunchTask": "gcc.exe build active file"
}
]
}
{
"version": "2.0.0",
"tasks": [
{
"type": "shell",
"label": "shell: gcc.exe build active file",
"command": "C:\\ProgramData\\chocolatey\\bin\\gcc.exe",
"args": [
"-g",
"${file}",
"-o",
"${fileDirname}\\${fileBasenameNoExtension}.exe"
],
"options": {
"cwd": "C:\\ProgramData\\chocolatey\\bin"
},
"problemMatcher": [
"$gcc"
],
"group": "build"
}
]
}
Notice the different:
"preLaunchTask": "gcc.exe build active file" //from the launch.json
"label": "shell: gcc.exe build active file" //from the task.json
They are not the same. It will cause an error when press F5 on the keyboard.

If correct them as the same, the bug gone.
"preLaunchTask": "gcc.exe build active file" //from the launch.json
"label": "gcc.exe build active file" //from the task.json
The default generated launch.json and task.json files are below:
Notice the different:
They are not the same. It will cause an error when press F5 on the keyboard.
If correct them as the same, the bug gone.