无法启动调试。程序路径'/ 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代码/矩形”丢失或无效怎么办?你能证实这种路径存在吗? :-) –
是的,看看“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名学生287 5月24日13:27 rectangle –