Debug & Build C++ Project

How to set up C++ Compiler with Visual Studio Code. - Setup Visual Studio Code for Multi-File C++ Projects

see also

Build task

VSCode’s build in keyboard shortcut to task by making it of type build. The easiest way to set up tasks is to press ctrl+shift+b.

tasks.json

{
    // See https://go.microsoft.com/fwlink/?LinkId=733558
    // for the documentation about the tasks.json format
    "version": "2.0.0",
    "tasks": [
        {
            "label": "build",
            "type": "shell",
            "command": "make",
            "group": {
                "kind": "build",
                "isDefault": true,
            },
            
            "problemMatcher": "$gcc"
        }
    ]
}

Debug Task / LLDB / GDB

Ctrl+F5 => Run / F5 => Debug

launch.json

"preLaunchTask": "build"

C/C++ configurations

Written on September 19, 2020, Last update on December 31, 2023
debug-c++ vscode gdb c++