Skip to content

Instantly share code, notes, and snippets.

@minhducsun2002
Forked from dungwinux/tasks.json
Last active June 5, 2019 14:27
Show Gist options
  • Save minhducsun2002/0b27f739b646c9b8d0b77322412c59ac to your computer and use it in GitHub Desktop.
Save minhducsun2002/0b27f739b646c9b8d0b77322412c59ac to your computer and use it in GitHub Desktop.
VSCode C++ tasks script
{
"version": "2.0.0",
"tasks": [
{
"label": "Build with C++17",
"group": "build",
"command": "g++",
"args": [ "-std=c++17", "${workspaceFolder}/${relativeFile}", "-o", "${workspaceFolder}/${fileBasenameNoExtension}" ],
"promptOnClose": false,
"problemMatcher": {
"owner": "cpp",
"fileLocation": [ "relative", "${workspaceFolder}" ],
"pattern": {
"regexp": "^(.*):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)$",
"file": 1,
"line": 2,
"column": 3,
"severity": 4,
"message": 5
}
}
},
{
"label": "Build with C++14",
"group": "build",
"command": "g++",
"args": [ "-std=c++14", "${workspaceFolder}/${relativeFile}", "-o", "${workspaceFolder}/${fileBasenameNoExtension}" ],
"promptOnClose": false,
"problemMatcher": {
"owner": "cpp",
"fileLocation": [ "relative", "${workspaceFolder}" ],
"pattern": {
"regexp": "^(.*):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)$",
"file": 1,
"line": 2,
"column": 3,
"severity": 4,
"message": 5
}
}
},
{
"label": "Build with C++11",
"group": "build",
"command": "g++",
"args": [ "-std=c++11", "${workspaceFolder}/${relativeFile}", "-o", "${workspaceFolder}/${fileBasenameNoExtension}" ],
"promptOnClose": false,
"problemMatcher": {
"owner": "cpp",
"fileLocation": [ "relative", "${workspaceFolder}" ],
"pattern": {
"regexp": "^(.*):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)$",
"file": 1,
"line": 2,
"column": 3,
"severity": 4,
"message": 5
}
}
},
{
"label": "Invoke compiled binary",
"group": "build",
"command": "${workspaceFolder}/${workspaceFolder}/${fileBasenameNoExtension}",
"promptOnClose": false,
},
{
"label": "Build with C++17 and POSIX threading enabled",
"group": "build",
"command": "g++",
"args": [ "-std=c++17", "-pthread", "${workspaceFolder}/${relativeFile}", "-o", "${workspaceFolder}/${fileBasenameNoExtension}" ],
"promptOnClose": false,
"problemMatcher": {
"owner": "cpp",
"fileLocation": [ "relative", "${workspaceFolder}" ],
"pattern": {
"regexp": "^(.*):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)$",
"file": 1,
"line": 2,
"column": 3,
"severity": 4,
"message": 5
}
}
},
{
"label": "Build with C++14 and POSIX threading enabled",
"group": "build",
"command": "g++",
"args": [ "-std=c++14", "-pthread", "${workspaceFolder}/${relativeFile}", "-o", "${workspaceFolder}/${fileBasenameNoExtension}" ],
"promptOnClose": false,
"problemMatcher": {
"owner": "cpp",
"fileLocation": [ "relative", "${workspaceFolder}" ],
"pattern": {
"regexp": "^(.*):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)$",
"file": 1,
"line": 2,
"column": 3,
"severity": 4,
"message": 5
}
}
},
{
"label": "Build with C++17 and debugging enabled",
"group": "build",
"command": "g++",
"args": [ "-std=c++17", "-g", "${workspaceFolder}/${relativeFile}", "-o", "${workspaceFolder}/${fileBasenameNoExtension}" ],
"promptOnClose": false,
"problemMatcher": {
"owner": "cpp",
"fileLocation": [ "relative", "${workspaceFolder}" ],
"pattern": {
"regexp": "^(.*):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)$",
"file": 1,
"line": 2,
"column": 3,
"severity": 4,
"message": 5
}
}
},
{
"label": "Build with C++14 and debugging enabled",
"group": "build",
"command": "g++",
"args": [ "-std=c++14", "-g", "${workspaceFolder}/${relativeFile}", "-o", "${workspaceFolder}/${fileBasenameNoExtension}" ],
"promptOnClose": false,
"problemMatcher": {
"owner": "cpp",
"fileLocation": [ "relative", "${workspaceFolder}" ],
"pattern": {
"regexp": "^(.*):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)$",
"file": 1,
"line": 2,
"column": 3,
"severity": 4,
"message": 5
}
}
},
{
"label": "Build with C++11 and debugging enabled",
"group": "build",
"command": "g++",
"args": [ "-std=c++11", "-g", "${workspaceFolder}/${relativeFile}", "-o", "${workspaceFolder}/${fileBasenameNoExtension}" ],
"promptOnClose": false,
"problemMatcher": {
"owner": "cpp",
"fileLocation": [ "relative", "${workspaceFolder}" ],
"pattern": {
"regexp": "^(.*):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)$",
"file": 1,
"line": 2,
"column": 3,
"severity": 4,
"message": 5
}
}
},
{
"label": "Build with C++17 and ENG defined",
"group": "build",
"command": "g++",
"args": [ "-std=c++17", "-DENG", "${workspaceFolder}/${relativeFile}", "-o", "${workspaceFolder}/${fileBasenameNoExtension}" ],
"promptOnClose": false,
"problemMatcher": {
"owner": "cpp",
"fileLocation": [ "relative", "${workspaceFolder}" ],
"pattern": {
"regexp": "^(.*):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)$",
"file": 1,
"line": 2,
"column": 3,
"severity": 4,
"message": 5
}
}
},
{
"label": "Build with C++14 and ENG defined",
"group": "build",
"command": "g++",
"args": [ "-std=c++14", "-DENG", "${workspaceFolder}/${relativeFile}", "-o", "${workspaceFolder}/${fileBasenameNoExtension}" ],
"promptOnClose": false,
"problemMatcher": {
"owner": "cpp",
"fileLocation": [ "relative", "${workspaceFolder}" ],
"pattern": {
"regexp": "^(.*):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)$",
"file": 1,
"line": 2,
"column": 3,
"severity": 4,
"message": 5
}
}
}
]
}
{
"version": "2.0.0",
"tasks": [
{
"label": "Build with C++17",
"group": "build",
"command": "g++",
"args": [ "-std=c++17", "${relativeFile}", "-o", "${fileBasenameNoExtension}.exe" ],
"promptOnClose": false,
"problemMatcher": {
"owner": "cpp",
"fileLocation": [ "relative", "${workspaceFolder}" ],
"pattern": {
"regexp": "^(.*):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)$",
"file": 1,
"line": 2,
"column": 3,
"severity": 4,
"message": 5
}
}
},
{
"label": "Build with C++11",
"group": "build",
"command": "g++",
"args": [ "-std=c++11", "${relativeFile}", "-o", "${fileBasenameNoExtension}.exe" ],
"promptOnClose": false,
"problemMatcher": {
"owner": "cpp",
"fileLocation": [ "relative", "${workspaceFolder}" ],
"pattern": {
"regexp": "^(.*):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)$",
"file": 1,
"line": 2,
"column": 3,
"severity": 4,
"message": 5
}
}
},
{
"label": "Build with C++14",
"group": "build",
"command": "g++",
"args": [ "-std=c++14", "${relativeFile}", "-o", "${fileBasenameNoExtension}.exe" ],
"promptOnClose": false,
"problemMatcher": {
"owner": "cpp",
"fileLocation": [ "relative", "${workspaceFolder}" ],
"pattern": {
"regexp": "^(.*):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)$",
"file": 1,
"line": 2,
"column": 3,
"severity": 4,
"message": 5
}
}
},
{
"label": "Run compiled executable",
"group": "build",
"command": "start",
"args": [ "${fileBasenameNoExtension}.exe" ],
"promptOnClose": false,
"problemMatcher": {
"owner": "cpp",
"fileLocation": [ "relative", "${workspaceFolder}" ],
"pattern": {
"regexp": "^(.*):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)$",
"file": 1,
"line": 2,
"column": 3,
"severity": 4,
"message": 5
}
}
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment