Kyuhyong You
Kyuhyong You

Reputation: 173

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?

Upvotes: 3

Views: 3256

Answers (2)

jklebes
jklebes

Reputation: 156

I had the same problem: only a "gdb (launch)" option appeared, while documentation says option "g++ build and debug active file" should appear.

In my case it was because the debugger gdb was not installed on my system at all. I had neglected to follow linux setup: https://code.visualstudio.com/docs/cpp/config-linux first. Try sudo apt install gdb.

Upvotes: 2

Kyuhyong You
Kyuhyong You

Reputation: 173

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

Upvotes: 1

Related Questions