关于vs code Debug调试时候出现“找不到任务C/C++: g++.exe build active file” 解决方法

vs code Debug调试时候出现“找不到任务C/C++: g++.exe build active file” ,出现报错,Debug失败

 关于vs code Debug调试时候出现“找不到任务C/C++: g++.exe build active file” 解决方法_第1张图片


后来经过摸索和上网查找资料解决问题

方法如下

在Vs code的操作页面左侧有几个配置文件

红框里的是需要将要修改的文件

关于vs code Debug调试时候出现“找不到任务C/C++: g++.exe build active file” 解决方法_第2张图片

 查看tasks.json和launch.json框选"  "的字符串是否一致

关于vs code Debug调试时候出现“找不到任务C/C++: g++.exe build active file” 解决方法_第3张图片

关于vs code Debug调试时候出现“找不到任务C/C++: g++.exe build active file” 解决方法_第4张图片

完成后,按F5启动调试,报错弹窗消失,顺利完成调试

关于vs code Debug调试时候出现“找不到任务C/C++: g++.exe build active file” 解决方法_第5张图片

下面是 我的 Vs code中tasks.json和launch.json源文件

{
    "tasks": [
        {
            "type": "shell",
            "label": "g++ build active file",
            "command": "/usr/bin/g++",
            "args": [
                "-g",
                "${file}",
                "-o",
                "${fileDirname}/${fileBasenameNoExtension}"
            ],
            "options": {
                "cwd": "/usr/bin"
            }
        },
        {
            "type": "cppbuild",
            "label": "C/C++: g++ 生成活动文件",
            "command": "/usr/bin/g++",
            "args": [
                "-fdiagnostics-color=always",
                "-g",
                "${file}",
                "-o",
                "${fileDirname}/${fileBasenameNoExtension}"
            ],
            "options": {
                "cwd": "${fileDirname}"
            },
            "problemMatcher": [
                "$gcc"
            ],
            "group": "build",
            "detail": "编译器: /usr/bin/g++"
        }
    ],
    "version": "2.0.0"
}

 

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "name": "g++ - 生成和调试活动文件",
            "type": "cppdbg",
            "request": "launch",
            "program": "${fileDirname}/${fileBasenameNoExtension}",
            "args": [],
            "stopAtEntry": false,
            "cwd": "${workspaceFolder}",
            "environment": [],
            "externalConsole": false,
            "MIMode": "gdb",
            "setupCommands": [
                {
                    "description": "为 gdb 启用整齐打印",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                }
            ],
            "preLaunchTask": "g++ build active file",
            "miDebuggerPath": "/usr/bin/gdb"
        }
    ]
}

 

你可能感兴趣的:(随手笔记(解决遇到过的问题),c++,linux,arm,c语言,ubuntu)