c++ - 我无法从 mingw 开始使用 gdb 进行调试
问题描述
我正在按照本指南在 VSCode 中使用 mingw 和 c++,但我陷入了让我开始调试的步骤。VSCode 控制台给了我这个错误:
错误:无法开始调试。GDB 意外退出。程序 'G:\ccompiler\projects\helloworld\helloworld.exe' 以代码 0 (0x00000000) 退出。
错误:在启动过程中程序以代码 0xc0000139 退出。
有人可以帮我解决这个问题吗?我的代码和 JSON 文件与指南中的完全相同,除了我的 mingw 文件夹的编译器和调试器路径。
我的launch.json
:
{
"version": "0.2.0",
"configurations": [
{
"name": "(gdb) Launch",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/helloworld.exe",
"args": [],
"stopAtEntry": true,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"miDebuggerPath": "G:/ccompiler/mingw32/bin/gdb.exe",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
]
}
]
}
我的源代码:
#include <iostream>
#include <vector>
#include <string>
using namespace std;
int main()
{
vector<string> msg {"Hello", "C++", "World", "from", "VS Code!"};
for (const string& word : msg)
{
cout << word << " ";
}
cout << endl;
}
解决方案
推荐阅读
- factory-bot - Rswag 中的 FactoryBot 故障
- kubernetes - 服务在 Kubernetes 中没有响应
- c# - C# - 如何遍历对象的每个属性和值
- gimp - Gimp:由于“GEGL-Error”而无法编辑图像
- haskell - 无法在全新的 GHC 安装中安装 set-monad 包
- lua - Trinitycore 关于可用于 LUA 脚本的 API 的问题
- html - 使用 R 中 daff 包中的 render_diff() 函数比较两个具有大量数据的数据帧
- chart.js - chart.js 如何显示刻度线但隐藏网格线
- swift - 启用金属 API 验证的位置 Swift
- android - 服务器端可以在谷歌计费库中做类似于移动端 comsumeAsync() 的事情吗?