Skip to content

Instantly share code, notes, and snippets.

@jeffjohnson9046
Created September 25, 2023 16:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jeffjohnson9046/32c3852c9126513defd69ce2445c61d2 to your computer and use it in GitHub Desktop.
Save jeffjohnson9046/32c3852c9126513defd69ce2445c61d2 to your computer and use it in GitHub Desktop.
A tasks.json file for compiling a simple C++ application in VS Code
/* Been going through the Learn C++ tutorial (https://www.learncpp.com/), and so far this seems to be a pretty good setup for
tasks.json in VS Code. This tasks.json file is specific for clang++ (I'm on macOS 13.x), so you may need to update the `args`
to suit your own environment. In particular, you will want to replace with {your application name here} with whatever you want
your build artifact to be named.
*/
{
"tasks": [
{
"type": "cppbuild",
"label": "C/C++: clang++ build active file",
"command": "/usr/bin/clang++",
"args": [
"-std=c++17",
"-Wall",
"-Wextra",
"-Weffc++",
"-Wconversion",
"-Werror",
"-pedantic-errors",
"-stdlib=libc++",
"-fcolor-diagnostics",
"-fansi-escape-codes",
"-g",
"${workspaceFolder}/*.cpp",
"-o",
"${workspaceFolder}/{your application name here}.exe"
],
"options": {
"cwd": "${workspaceFolder}"
},
"problemMatcher": [
"$gcc"
],
"group": {
"kind": "build",
"isDefault": true
},
"detail": "Task generated by Debugger."
}
],
"version": "2.0.0"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment