This is my tasks.json file which will compile, link and run my C++ when I press shift-Apple-B.
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [{
"label": "build C++",
"type": "shell",
"command": "g++",
"args": [
"-std=c++14", "-c", "-o", "${fileBasenameNoExtension}.o", "${file}"
],
"group": {
"kind": "build",
"isDefault": "false"
}
},
{
"label": "link C++",
"type": "shell",
"command": "g++",
"args": ["-o", "${fileBasenameNoExtension}", "${fileBasenameNoExtension}.o"],
,
"group": {
"kind": "build",
"isDefault": "false"
}
},
{
"label": "run",
"type": "shell",
"command": "./${fileBasenameNoExtension}",
"group": {
"kind": "build",
"isDefault": "false"
}
}
]
}