vscode cpp build tasks.json type:"cppbuild" error

Viewed 548

VSCode : 1.61.0
Linux: Ubuntu 20.04.3 LTS

I'm trying to build c++ program using by VSCode. when the run build, VSCode showing this message.

I know build tasking need matching launch.json file's preLaunchTask with tasks.json file's label. and I'm already set it.

tasks.json

{
    "tasks": [
        {
            "type": "cppbuild", // but "shell" is working
            "label": "C/C++: g++ build active file",
            "command": "/usr/bin/g++",
            "args": [
                "-g",
                "${file}",
                "-o",
                "${fileDirname}/${fileBasenameNoExtension}"
            ],
            "options": {
                "cwd": "${fileDirname}"
            },
            "problemMatcher": [
                "$gcc"
            ],
            "group": {
                "kind": "build",
                "isDefault": true
            },
            "detail": "Task generated by Debugger."
        }
    ],
    "version": "2.0.0"
}

launch.json

{
    // 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++ - Build and debug active file",
            "type": "cppdbg",
            "request": "launch",
            "program": "${fileDirname}/${fileBasenameNoExtension}",
            "args": [],
            "stopAtEntry": false,
            "cwd": "${fileDirname}",
            "environment": [],
            "externalConsole": false,
            "MIMode": "gdb",
            "setupCommands": [
                {
                    "description": "Enable pretty-printing for gdb",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                }
            ],
            "preLaunchTask": "C/C++: g++ build active file",
            "miDebuggerPath": "/usr/bin/gdb"
        }
    ]
}

The problem is, if I change the "type" value in tasks.json, from shell to cppbuild, It doesn't work and show the error message like to.

showing error message when the run build

what is different "cppbuild" and "shell"? and What should I do how using "cppbuild" value?

0 Answers
Related