Gau*_*don 6 c++ visual-studio-code vscode-debugger
我的来源file.cpp:
#include <iostream>
using namespace std;
int main()
{
int x = 1;
int y = 2;
cout << x + y << endl;
return 0;
}
Run Code Online (Sandbox Code Playgroud)
我使用编译它g++ -g file.cpp,然后我的launch.json文件是这样的:
{
"version": "0.2.0",
"configurations": [
{
"name": "(gdb) Launch",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/a.out",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": true,
"MIMode": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
]
}
]
}
Run Code Online (Sandbox Code Playgroud)
我的目录结构是:
- workspaceFolder
- .vscode
- launch.json
- a.out
- file.cpp
Run Code Online (Sandbox Code Playgroud)
当我单击Debug选项卡中的绿色"Start debugging"箭头时,我在Debug Console中收到此错误:
Stopping due to fatal error: NullReferenceException: Object reference not set to an instance of an object
Run Code Online (Sandbox Code Playgroud)
我究竟做错了什么?我看过每个教程和调试C++似乎适用于所有这些,除了在我的情况下.我也安装了C/C++(Microsoft)扩展,并运行Ubuntu 64位.
我有同样的问题,不知道为什么,但设置"externalConsole"在launch.json以false奏效了我.
此问题已在 15天前在Microsoft/vscode-cpptools上报告,自v1.30.0以来一直在发生,并且应该在最新的内部人员构建中修复.
| 归档时间: |
|
| 查看次数: |
1785 次 |
| 最近记录: |