解决Vscode Unable to start debugging

解决Vscode Unable to start debugging

insert image description here
First, check whether there is Chinese in the path, this problem will occur to a large extent.

Second, modify the vscode/launch.json and vscode/tasks.json files

{
    
    
    "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++"
		}
	]
}

pending upgrade

Guess you like

Origin blog.csdn.net/qq_43508270/article/details/125706086