I'm following this guide about using mingw with c++ in VSCode, but I got stuck in the step that has me start debugging. The VSCode console gave me this error:
ERROR: Unable to start debugging. GDB exited unexpectedly. The program 'G:\ccompiler\projects\helloworld\helloworld.exe' has exited with code 0 (0x00000000).
ERROR: During startup program exited with code 0xc0000139.
Can someone help me fix this issue? My code and JSON files are exactly the same as the guide's except for my compiler and debugger path to the mingw folder.
My 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
}
]
}
]
}
My source code:
#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;
}