vscode配置C++报错unable to start debugging.unexpected GDB output from command |
您所在的位置:网站首页 › visual不能运行显示launchjson › vscode配置C++报错unable to start debugging.unexpected GDB output from command |
unable to start debugging.unexpected GDB output from command或preLaunchTask“g++”已终止,退出代码为1的可能解决方案 解决方案:文件目录不能存在中文 你要确定你的配置文件没有错误 launch,json { // 使用 IntelliSense 了解相关属性。 // 悬停以查看现有属性的描述。 // 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387 "version": "0.2.0", "configurations": [ { "name": "task g++", // 配置名称,将会在启动配置的下拉菜单中显示 "type": "cppdbg", //配置类型,只能为cppdbg "request": "launch", "program": "${fileDirname}\\${fileBasenameNoExtension}.exe", "args": [], "stopAtEntry": false, "cwd": "${workspaceFolder}", "environment": [], "externalConsole": false, //true显示外置的控制台窗口,false显示内置终端 "MIMode": "gdb", "miDebuggerPath": "D:\\MinGw\\mingw64\\bin\\gdb.exe", //gdb的文件地址 "setupCommands": [ { "description": "为 gdb 启用整齐打印", "text": "-enable-pretty-printing", "ignoreFailures": true, } ], "preLaunchTask": "task g++" //和tasks中label保持一致 } ] }task,json { "version": "2.0.0", "tasks": [ { "label": "task g++", //任务的名字,就是刚才在命令面板中选择的时候所看到的,可以自己设置 "type": "shell", "command": "g++", "args": [ //编译时候的参数 "-g", //添加gdb调试选项 "${file}", "-o", //指定生成可执行文件的名称 "${fileDirname}\\${fileBasenameNoExtension}.exe" ], "options": { "cwd": "${workspaceFolder}" }, "problemMatcher": [ "$gcc" ], "group": { "kind": "build", "isDefault": true //表示快捷键Ctrl+Shift+B可以运行该任务 }, } ] }如果都没错,那就是上面第一张图片中标红的原因——文件目录名中含中文,需要改成全英才行,因为是当都放在桌面,所以需要改变桌面存放文件的默认地址 |
今日新闻 |
推荐新闻 |
CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3 |