vscode-launchprogram-xxx-does-not-exist

9次阅读

共计 1260 个字符,预计需要花费 4 分钟才能阅读完成。

测试环境 deepin 和 windows


问题的另类描述

  • linux 下 vs code 配置 c 语言环境
  • launch:program “xxxx” does not exist
  • tasks.json 和 launch.json 的关系
  • 终端将被任务重用,按任意键关闭。
  • [1] + Done “/usr/bin/gdb” –interpreter=mi –tty=${DbgTerm} 0<“/tmp/Microsoft-MIEngine-In-9liq8sx2.h8m” 1>”/tmp/Microsoft-MIEngine-Out-rs8nztsh.yr1″

对于新手来说,处理这类内容(两个 json 和那一堆参数)真的好难,把我的填坑记录下来,以供后人瞻仰。

常见问题

Q1:tasks.json 和 launch.json 的关系

在当前文件是 C ++ 的情况下,tasks 可以被用来做编译,而 launch 用来执行编译好的文件

Q2:launch:program “xxxx” does not exist

我发生这个错误的原因是因为 tasks.json 的 ”label” 参数值和 launch.json 的 ”preLaunchTask” 参数值不一致

解决方法就是 让两者一致。我把他两的值都设为 ”build c program”

Q3:终端将被任务重用,按任意键关闭。

> Executing task: gcc -g -o main /home/yjc/Desktop/c/test/main.c <


终端将被任务重用,按任意键关闭。

好像是正常现象

Q4:[1] + Done “/usr/bin/gdb” –interpreter=mi –tty=${DbgTerm} 0<“/tmp/Microsoft-MIEngine-In-9liq8sx2.h8m” 1>”/tmp/Microsoft-MIEngine-Out-rs8nztsh.yr1″

参考链接 [Linux] Debug launch command shows up in terminal window

大致意思是,正常现象,没有办法隐藏


附上我的 tasks.json 和 launch.json

tasks.json

{
  "version": "2.0.0",
  "tasks": [{
    "label": "build c program",
    "type": "shell",
    "command": "gcc",
    "args": [
      "-g",
      "-o",
      "${fileBasenameNoExtension}",
      "${file}"
    ]
  }]
}

launch.json

{
    "version": "0.2.0",
    "configurations": [{"name": "(gdb) Launch",
        "type": "cppdbg",
        "request": "launch",
        "program": "${fileDirname}/${fileBasenameNoExtension}",
        "cwd": "${workspaceFolder}",
        "preLaunchTask": "build c program",
    }]
}

对标准内容做了很多删减,初学用不到怎么多内容

正文完
 0