找不到G++尝试添加配置时构建和调试活动文件

发布于 2025-01-22 16:24:32 字数 1353 浏览 0 评论 0原文

我正在运行最新的VSCODE在Ubuntu上安装了.deb 20.04在笔记本电脑上。 安装了C/C ++扩展V 1.9.7(最新)。

我遵循了教程中的所有内容 https://code.visalstudio.com/docs/docs/docs/cpp/cpp/config/config-linux-linux-linux

我被困在调试中,因为我无法在启动中选择G ++构建和调试活动文件

。JSONTASK.JSON是自动生成的,如下所示

    {
    "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++"
        }
    ]
}

,当我尝试选择Run≫添加配置...并选择C ++(GDB/LLDB), 我认为“ G ++构建和调试活动文件”的下拉列表没有

有什么建议吗?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

稳稳的幸福 2025-01-29 16:24:32

我遇到了同样的问题:仅出现一个“ GDB(启动)”选项,而文档则说“ G ++构建和调试活动文件”应该出现。

就我而言,这是因为调试器gdb根本没有安装在我的系统上。我已经忽略了Linux设置: https://code.visualstudio.com/docs/ CPP/Config-Linux 首先。尝试sudo apt install gdb

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.

那请放手 2025-01-29 16:24:32

事实证明,这实际上是C/C ++扩展的最新版本(1.9.7)中的一个错误。

当我降级到v1.8.4时,添加运行配置没有问题。

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文