Last active
July 11, 2023 20:17
-
-
Save rohitsardessai/7b46f4a676b7d266dc87718cfd526bc5 to your computer and use it in GitHub Desktop.
VSCode tasks.json file for debugging and testing a c program. The first task builds the program and creates an executable. The second task runs the program with valgrind to check for memory leaks. The executable is saved in a /build directory. The third, fourth and fifth are to be used with CMake.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"tasks": [ | |
{ | |
"type": "cppbuild", | |
"label": "R: C/C++: gcc-11 build active file", | |
"command": "/usr/bin/gcc-11", | |
"args": [ | |
"-fdiagnostics-color=always", | |
"-g", | |
"${fileDirname}/**.c", | |
"-o", | |
"${fileDirname}/build/${fileBasenameNoExtension}" | |
], | |
"options": { | |
"cwd": "${fileDirname}" | |
}, | |
"problemMatcher": [ | |
"$gcc" | |
], | |
"group": { | |
"kind": "build", | |
"isDefault": true | |
}, | |
"detail": "Task generated by Debugger." | |
}, | |
{ | |
"type": "shell", | |
"label": "R: Run with Valgrind", | |
"command": "valgrind", | |
"args": [ | |
"--leak-check=full", | |
"./build/${fileBasenameNoExtension}" | |
], | |
"options": { | |
"cwd": "${fileDirname}" | |
}, | |
"group": { | |
"kind": "test", | |
"isDefault": false | |
}, | |
"detail": "Run the program with Valgrind." | |
}, | |
{ | |
"label": "R: C/C++: cmake build", | |
"type": "shell", | |
"command": "cmake", | |
"args": [ | |
"-S", | |
"${fileDirname}", | |
"-B", | |
"${fileDirname}/build" | |
], | |
"group": { | |
"kind": "build", | |
"isDefault": false | |
}, | |
"detail": "CMake build task." | |
}, | |
{ | |
"label": "R: C/C++: make build", | |
"type": "shell", | |
"command": "make", | |
"args": [ | |
"-C", | |
"${fileDirname}/build" | |
], | |
"group": { | |
"kind": "build", | |
"isDefault": false | |
}, | |
"detail": "Make build task.", | |
"dependsOn": "R: C/C++: cmake build" | |
}, | |
{ | |
"label": "R: C/C++: CMake and make build", | |
"type": "shell", | |
"dependsOn": [ | |
"R: C/C++: cmake build", | |
"R: C/C++: make build" | |
], | |
"group": { | |
"kind": "build", | |
"isDefault": true | |
}, | |
"detail": "CMake and make build task." | |
} | |
], | |
"version": "2.0.0" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment