LlewynDav 2021-07-14 16:16 采纳率: 82.4%
浏览 9575

VScode调试时显示launch:program。does not exist

下完什么也没动就显示这个,是program地址的问题吗还是什么原因,求帮助
img

img

  • 写回答

1条回答 默认 最新

  • 浪客 2021-07-14 16:43
    关注

    vscode编译运行c++需要配置launch.json和task.json文件。

    launch.json:
    {
      "name": "G++ Debug",//调试界面中显示的名字
      "type": "cppdbg",
      "preLaunchTask": "g++debug",//这个很重要,在运行前进行编译的命令,对应task配置
      "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", //launch.json中要调用的名字。
        "type": "shell",
        "command": "g++.exe", //G++.exe路径需要配置到PATH里
        "args": [
            "${file}",
            "-g", //debug参数
            "-fexec-charset=gbk""-o",
            "${fileDirname}/${fileBasenameNoExtension}.exe",
        ]
    }
    
    评论

报告相同问题?

问题事件

  • 创建了问题 7月14日