VScode debug c++


Im trying to setup vscode to debug C++. I am on windows. My code runs fine but whenever I try debugging, I am unable to step or gather information on variables even though everything appears to be running smoothly.

Here is my FirstCPP.CPP file:

#include <iostream>
#include <vector>
#include <string>

using namespace std;

int main()
    vector<string> msg {"Hello", "C++", "World", "from", "VS Code", "and the C++ extension!"};

    for (const string& word : msg)
        cout << word << " ";
    cout << endl;

This is my launch.json file:

    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
            "name": "(gdb) Launch",
            "type": "cppdbg",
            "request": "launch",
            "program": "C:\\Users\\marti\\projects\\helloworld\\.vscode\\FirstCPP.exe",
            "args": [],
            "stopAtEntry": true,
            "cwd": "C:\\Users\\marti\\projects\\helloworld\\.vscode",
            "environment": [],
            "externalConsole": true,
            "MIMode": "gdb",
            "miDebuggerPath": "C:\\Program Files\\mingw-w64\\x86_64-8.1.0-posix-seh-rt_v6-rev0\\mingw64\\bin\\gdb.exe",
            "setupCommands": [
                    "description": "Enable pretty-printing for gdb",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true

This is my tasks.json file:

    // See https://go.microsoft.com/fwlink/?LinkId=733558
    // for the documentation about the tasks.json format
    "version": "2.0.0",
    "tasks": [
            "label": "build hello world",
            "type": "shell",
            "command": "g++",
            "args": ["-g", "-o", "helloworld", "FirstCPP.cpp"],
            "group": {
                "kind": "build",
                "isDefault": true

And here is my c_cpp_properties.json file:

    "configurations": [
            "name": "Win32",
            "includePath": [
            "defines": [
            "compilerPath": "C:\\Program Files\\mingw-w64\\x86_64-8.1.0-posix-seh-rt_v6-rev0\\mingw64\\bin\\g++.exe",
            "cStandard": "gnu17",
            "cppStandard": "gnu++14",
            "intelliSenseMode": "gcc-x64"
    "version": 4

Whenever I try to debug my code, I receive this in the debug console:

Loaded 'C:\WINDOWS\System32\msvcrt.dll'. Symbols loaded.
Loaded 'C:\Program Files\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64\opt\bin\libgcc_s_seh-1.dll'. Symbols loaded.
Loaded 'C:\Program Files\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64\bin\libstdc++-6.dll'. Symbols loaded.
Loaded 'C:\WINDOWS\System32\user32.dll'. Symbols loaded.
Loaded 'C:\WINDOWS\System32\win32u.dll'. Symbols loaded.
Loaded 'C:\WINDOWS\System32\gdi32.dll'. Symbols loaded.
Loaded 'C:\Program Files\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64\opt\bin\libwinpthread-1.dll'. Symbols loaded.
Loaded 'C:\WINDOWS\System32\gdi32full.dll'. Symbols loaded.
Loaded 'C:\WINDOWS\System32\msvcp_win.dll'. Symbols loaded.
Loaded 'C:\WINDOWS\System32\ucrtbase.dll'. Symbols loaded.
Loaded 'C:\WINDOWS\System32\imm32.dll'. Symbols loaded.
Execute debugger commands using "-exec <command>", for example "-exec info registers" will list registers in use (when GDB is the debugger)
Single stepping until exit from function main,
which has no line number information.
-exec info registers
ERROR: GDB exited unexpectedly with exit code -1073741819 (0xC0000005). Debugging will now abort.
The program 'C:\Users\marti\projects\helloworld\.vscode\FirstCPP.exe' has exited with code -1 (0xffffffff).

Error: GDB exited unexpectedly with exit code -1073741819 (0xC0000005).

asked on Stack Overflow Jan 3, 2021 by Mark Sullivan • edited Jan 3, 2021 by user4581301

0 Answers

Nobody has answered this question yet.

User contributions licensed under CC BY-SA 3.0