解决Vscode Unable to start debugging

解决Vscode Unable to start debugging

解决Vscode Unable to start debugging_第1张图片
首先,检查路径中是否含有中文,很大程度上会出现此问题。

其次,修改vscode/launch.json和vscode/tasks.json文件

{
    "version": "0.2.0",
    "configurations": [
      {
        "name": "g++ build and debug active file",//配置名称
        "type": "cppdbg",/配置类型
        "request": "launch",//请求配置类型
        "program": "${fileDirname}/${fileBasenameNoExtension}",
        "args": [],//程序调试时传递给程序的命令行参数,空即可
        "stopAtEntry": false,//为true时程序将暂停在入口处
        "cwd": "${workspaceFolder}",
        "environment": [],//环境变量,空即可
        "externalConsole": false,//为true时使用单独的cmd窗口
        "MIMode": "gdb",//指定连接的调试器
        "setupCommands": [
          {
            "description": "Enable pretty-printing for gdb",
            "text": "-enable-pretty-printing",
            "ignoreFailures": true
          }
        ],
        "preLaunchTask": "g++ build active file",
        "miDebuggerPath": "/usr/bin/gdb"
      }
    ]
  }

{
	"version": "2.0.0",
	"tasks": [
		{
			"type": "cppbuild",
			"label": "C/C++: g++ 生成活动文件",
			"command": "/usr/bin/g++",
			"args": ["-g", "${file}", "-o", "${fileDirname}/${fileBasenameNoExtension}"],
			"options": {
				"cwd": "${fileDirname}"
			},
			"problemMatcher": [
				"$gcc"
			],
			"group": {
				"kind": "build",
				"isDefault": true
			},
			"detail": "编译器: /usr/bin/g++"
		}
	]
}

待更新

你可能感兴趣的:(vscode,vscode,bash,ide)