デバッグを開始できません。プログラムパス '/ home/student/Documents/Visual Studio Code/rectangle'が存在しないか、無効です。VSコードのC++:デバッグを開始できません - プログラムパスがないか無効です
マイlaunch.jsonは次のようになります。
{
"version": "0.2.0",
"configurations": [
{
"name": "C++ Launch (GDB)",
"type": "cppdbg",
"request": "launch",
"launchOptionType": "Local",
"miDebuggerPath": "/usr/bin/gdb",
"targetArchitecture": "x64",
"program": "${workspaceRoot}/rectangle",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceRoot}",
"environment": []
},
{
"name": "C++ Attach (GDB)",
"type": "cppdbg",
"request": "launch",
"launchOptionType": "Local",
"miDebuggerPath": "/usr/bin/gdb",
"targetArchitecture": "x64",
"program": "${workspaceRoot}/rectangle",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceRoot}",
"environment": []
}
]
}
私のC++プログラムは、このです:
#include <iostream>
using namespace std;
int main()
{
double length, width, area;
cout << "Enter the length: ";
cin >> length;
cout << "Enter the width: ";
cin >> width;
area = length * width;
cout << "The area is " << area << endl;
return 0;
}
私たちに多くの情報を提供しましたが、プログラムパス '/ home/student/Documents/Visual Studio Code/rectangle'はありませんか?あなたはそのようなパスが存在することを確認できますか? :-) –
はい、私のパスの "print working directory"の結果を見てください:[student @ rhel7 Visual Studio Code] $ pwd /home/student/Documents/Visual Studioコード [student @ rhel7 Visual Studio Code] $ ls -l長方形 -rw-rw-r--。 1 student student 287 5月24 13:27 rectangle –