VS Code Configuration for Debugging C++ programs

This is the configuration I use for debugging C++ programs in vscode:

Build Tasks

{
    "version": "2.0.0",
    "tasks": [
        {
            "label": "build",
            "type": "shell",
            "command": "/usr/bin/clang++",
            "args": [
	            "-std=c++20",
	            "-g",
	            "-o",
	            "${fileDirname}/${fileBasenameNoExtension}",
	            "${file}"
	        ],
            "group": {
                "kind": "build",
                "isDefault": true
            },
            "detail": "Generated task to build the project"
        }
    ]
}

Note

Launch

{
 "version": "0.2.0",
 "configurations": [
  {
   "type": "lldb",
   "request": "launch",
   "name": "Debug",
   "program": "${workspaceFolder}/${relativeFileDirname}/${fileBasenameNoExtension}",
   "cwd": "${fileDirname}",
  }
 ]
}

Notes