Last active
August 19, 2022 03:44
-
-
Save TyeolRik/be6c4d1c7ccfac3bd06ece91d5812e72 to your computer and use it in GitHub Desktop.
Compile and Run AT ONCE in Linux(Debian) VS Code. Just Press 'Ctrl + Shift + B'
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
// This tasks.json is for C++. | |
// In *.cpp, Just Press "Ctrl + Shift + B" for Compile, Run, Delete Compiled Binary File AT ONCE. | |
{ | |
"version": "2.0.0", | |
"type": "shell", | |
"tasks": [ | |
{ | |
"label": "save and compile for C++", | |
"command": "g++", | |
"args": [ | |
"-g", | |
"${file}", | |
"-o", | |
"${fileDirname}/${fileBasenameNoExtension}", | |
"-O2" | |
], | |
"options": { | |
"cwd": "${workspaceFolder}" | |
}, | |
"problemMatcher": [ | |
"$gcc" | |
], | |
"group": "build", | |
"presentation": { | |
"echo": false, | |
"showReuseMessage": false | |
} | |
}, | |
{ | |
"label": "save and compile for C", | |
"command": "gcc", | |
"args": [ | |
"-g", | |
"${file}", | |
"-o", | |
"${fileDirname}/${fileBasenameNoExtension}" | |
], | |
"options": { | |
"cwd": "${workspaceFolder}" | |
}, | |
"problemMatcher": [ | |
"$gcc" | |
], | |
"group": "build", | |
"presentation": { | |
"echo": false, | |
"showReuseMessage": false | |
} | |
}, | |
// Execute Binary File (Compiled File) | |
{ | |
"label": "execute", | |
"command": "bash", | |
"group": "test", | |
"args": [ | |
"${fileDirname}/${fileBasenameNoExtension}" | |
], | |
"presentation": { | |
"echo": false, | |
"showReuseMessage": false | |
} | |
}, | |
// Test Run Binary File (Compiled File) | |
{ | |
"label": "Run C++", | |
"type": "shell", | |
"command": "", | |
"group": "build", | |
"args": [ | |
"${fileDirname}/${fileBasenameNoExtension}" | |
], | |
"dependsOn": ["save and compile for C++"], | |
"presentation": { | |
"echo": false, | |
"showReuseMessage": false, | |
"clear": true | |
} | |
}, | |
// Remove Compiled File | |
{ | |
"label": "Remove Compiled File", | |
"command": "rm", | |
"args": [ | |
"-rf", | |
"${fileDirname}/${fileBasenameNoExtension}" | |
], | |
"group": { | |
"kind": "build", | |
"isDefault": true | |
}, | |
"dependsOn": ["Run C++"], | |
"presentation": { | |
"echo": false, | |
"showReuseMessage": false | |
} | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment