[vscode] launch:program xxx does not exist

Time:2020-8-14

Test environment deepin and windows


Another description of the problem

  • Configure C language environment with vs Code under Linux
  • launch:program “xxxx” does not exist
  • tasks.json and launch.json The relationship between
  • The terminal will be reused by the task and shut down by pressing any key.
  • [1] + Done “/usr/bin/gdb” –interpreter=mi –tty=${DbgTerm} 0<“/tmp/Microsoft-MIEngine-In-9liq8sx2.h8m” 1>”/tmp/Microsoft-MIEngine-Out-rs8nztsh.yr1″

It’s really hard for a novice to deal with this kind of content (two JSON and that pile of parameters). I’ll record my filling hole for future generations to look at.

Frequently asked questions about configuration vs Code

Q1: tasks.json And launch.json The relationship between

When the current file is C + +, tasks can be used to compile, and launch is used to execute compiled files


[vscode] launch:program  xxx does not exist

Create a tasks.json The file tells vs code how to build (compile) the program.

[vscode] launch:program  xxx does not exist

Translation: create a launch.json File to configure vs code to start GDB on WSL when F5 is pressed to debug the program.

Q2:launch:program “xxxx” does not exist

The reason why I made this mistake is becausetasks.json The “label” parameter value and launch.json ‘prelaunchtask’ parameter value of is inconsistent

The solution is to make the two consistent. I set both values to “build C program”

Q3: the terminal will be reused by the task. Press any key to close it.

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


The terminal will be reused by the task and shut down by pressing any key.

Normal phenomenon

Build the program

[vscode] launch:program  xxx does not exist

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

Refer to the link [Linux] debug launch command shows up in terminal window

It means that there is no way to hide normal phenomena


Attach my tasks.json and 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",
    }]
}

There are a lot of deletions to the standard content, so I can’t use much for beginners

Interpretation of official documents

This is a test of people’s English level.

Using C + + and WSL in vs Code

WSL is the abbreviation of windows subsystem for Linux, because Linux can be integrated in Windows 10. You only need to search, download and install in the Microsoft Store