Skip to content

Instantly share code, notes, and snippets.

@jenglamlow
Last active August 6, 2017 10:00
Show Gist options
  • Select an option

  • Save jenglamlow/f6f37dc052fe65d1c4b37eb219684ef4 to your computer and use it in GitHub Desktop.

Select an option

Save jenglamlow/f6f37dc052fe65d1c4b37eb219684ef4 to your computer and use it in GitHub Desktop.
Visual Studio Code (v1.14) C++ build project settings. F7 to build, F8 to build and run, F5 to Debug. This tasks setting is to build dedicated binary for the selected cpp file. Useful for quick C++ coding testing or algorithm practise.
{
"version": "0.2.0",
"configurations": [
{
"name": "C++ Launch",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceRoot}/${fileBasenameNoExtension}",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceRoot}",
"environment": [],
"externalConsole": true,
"linux": {
"MIMode": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
]
},
"osx": {
"MIMode": "lldb"
},
"windows": {
"MIMode": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
]
}
},
{
"name": "C++ Attach",
"type": "cppdbg",
"request": "attach",
"program": "${workspaceRoot}/${fileBasenameNoExtension}",
"processId": "${command:pickProcess}",
"linux": {
"MIMode": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
]
},
"osx": {
"MIMode": "lldb"
},
"windows": {
"MIMode": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
]
}
}
]
}
{
"version": "2.0.0",
"presentation": {
"reveal": "always",
"panel": "shared"
},
"suppressTaskName": true,
"tasks": [
{
"taskName": "Build",
"command": "g++",
"args": [
"-std=c++11",
"-O2",
"-Wall",
"-g",
"${fileBasename}",
"-lstdc++",
"-o",
"${fileBasenameNoExtension}"
],
"problemMatcher": {
"owner": "cpp",
"fileLocation": [
"relative",
"${workspaceRoot}"
],
"pattern": {
"regexp": "^(.*):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)$",
"file": 1,
"line": 2,
"column": 3,
"severity": 4,
"message": 5
}
},
"group": {
"kind": "build",
"isDefault": true
}
},
{
"taskName": "Run",
"dependsOn": [
"Build"
],
"command": "./${fileBasenameNoExtension}",
"type": "shell",
"args": []
},
{
"taskName": "Build and Run",
"dependsOn": [
"Build",
"Run"
],
"group": {
"kind": "test",
"isDefault": true
}
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment