Linux下の構成vscodeにlaunch:program'/youself path/a.out'does not existが表示されます
10129 ワード
Linux環境でvscodeを構成するときに現れた:launch:program'/youself path/a.out'does not exist
一般的にlaunchのためです.jsonファイルが配置されていないためtasks.jsonの
この問題を解決するのはtasksです.jsonの
launch.jsonファイル
tasks.jsonファイル
問題の原因
一般的にlaunchのためです.jsonファイルが配置されていないためtasks.jsonの
"label"
パラメータ値設定とlaunch.jsonの"preLaunchTask"
パラメータの不一致によるものである.デフォルト:{
"version": "0.2.0",
"configurations": [
{
"name": "(gdb) Launch",
"type": "cppdbg",
"request": "launch",
"program": "ENTER , ${workspaceFolder}/a.out",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
]
}
]
}
解決策
この問題を解決するのはtasksです.jsonの
"label"
パラメータ値設定とlaunch.jsonの"preLaunchTask"
(自分で追加する必要がある)のパラメータは一致する.また、修正“/a.out”
は“. out”
である.launch.jsonファイル
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "(gdb) Launch",
"type": "cppdbg",
"request": "launch",
"program": "${fileDirname}/${fileBasenameNoExtension}.out",// .out
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": true,
"MIMode": "gdb",
"preLaunchTask": "build",// build
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
]
}
]
}
tasks.jsonファイル
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "build",// build
"type": "shell",
"command": "g++",
"args": ["-g", "${file}", "-std=c++11", "-o", "${fileBasenameNoExtension}.out"] // “.out”
}
]
}