请问一下,遇到这样的原因是什么,编译器已下载GCC,c_cpp_properties文件中也已经配置好了编译器地址,但是一旦运行就出来如图所示
launch.json
{
"name": "G++ Debug", //调试页面里显示的名字,随便取
"type": "cppdbg",
"preLaunchTask": "g++debug", //运行前先执行编译任务,对应task.json文件
"request": "launch",
"program": "${fileDirname}/${fileBasenameNoExtension}.exe", //要调试的程序,要跟编译输出程序路径对应
"args": [], //运行参数
"stopAtEntry": false,
"cwd": "${fileDirname}",
"environment": [],
"externalConsole": true,
"MIMode": "gdb",
"miDebuggerPath": "gdb.exe",
"setupCommands": [
{
"description": "为 gdb 启用整齐打印",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
]
},
task.json
{
"label": "g++debug", //编译任务名称
"type": "shell",
"command": "g++.exe", //g++.exe所在路径需要设置到PATH里
"args": [
"${file}",
"-g", //调试参数,没有这个进入不了调试
"-fexec-charset=gbk"
]
},
{
// 使用 IntelliSense 了解相关属性。
// 悬停以查看现有属性的描述。
// 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "g++.exe - 生成和调试活动文件",
"type": "cppdbg",
"request": "launch",
"program": "${fileDirname}\\${fileBasenameNoExtension}.exe",
"args": [],
"stopAtEntry": false,
"cwd": "${fileDirname}",
"environment": [],
"externalConsole": true,
"MIMode": "gdb",
"miDebuggerPath": "D:\\mingw64\\bin\\gdb.exe",
"setupCommands": [
{
"description": "为 gdb 启用整齐打印",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
],
"preLaunchTask": "C/C++: g++.exe 生成活动文件"
}
]
}