'Cannot find g++ build and debug active file when trying to add configuration

I am running the latest vscode installed with .deb on ubuntu 20.04 on a laptop. C/C++ extension v 1.9.7 (latest) was installed.

I followed everything in the tutorial in https://code.visualstudio.com/docs/cpp/config-linux

and I am stuck in the debugging as I cannot choose g++ build and debug active file in launch.json

task.json is auto generated as below

    {
    "version": "2.0.0",
    "tasks": [
        {
            "type": "cppbuild",
            "label": "C/C++: g++ build active file",
            "command": "/usr/bin/g++",
            "args": [
                "-fdiagnostics-color=always",
                "-g",
                "${file}",
                "-o",
                "${fileDirname}/${fileBasenameNoExtension}"
            ],
            "options": {
                "cwd": "${fileDirname}"
            },
            "problemMatcher": [
                "$gcc"
            ],
            "group": {
                "kind": "build",
                "isDefault": true
            },
            "detail": "compiler: /usr/bin/g++"
        }
    ]
}

And when I tried to select Run > Add Configuration... and choose C++ (GDB/LLDB), I see no drop down list for "g++ build and debug active file" enter image description here

Any suggestions?



Solution 1:[1]

It turns out it is actually a bug in the latest version (1.9.7) of C/C++ extension.

When I downgrade the to v1.8.4 there is no problem adding run configuration.

enter image description here

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Kyuhyong You