Last active
June 5, 2020 10:32
-
-
Save gphg/6e4c413da8311212bd6d912a4471ddbc to your computer and use it in GitHub Desktop.
VSCode tasks.json for C/C++ programming on Ming-w64. See comments for more detail.
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
{ | |
"version": "2.0.0", | |
"tasks": [ | |
{ | |
"type": "shell", | |
"label": "C/C++: g++.exe build active file", | |
"command": "${env:MSYS2_ROOT}\\mingw64\\bin\\g++.exe", | |
"args": [ | |
"-g", | |
"${file}", | |
"-o", | |
"${fileDirname}\\${fileBasenameNoExtension}.exe" | |
], | |
"options": { | |
"cwd": "${workspaceFolder}", | |
"env": { | |
"PATH": "${env:MSYS2_ROOT}\\mingw64\\bin;${env:PATH}", | |
} | |
}, | |
"problemMatcher": [ | |
"$gcc" | |
], | |
"group": { | |
"kind": "build", | |
"isDefault": true | |
} | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Description: For security reason, I don't have
msys2
binaries on my%PATH%
, but I want to make it works while I'm having C/C++ coding session without have to change the Environment Variable every single time.Please pay attention that I have
%MSYS2_ROOT%
defined on Windows User's Environment Variable. It points to root ofmsys2
(in my case it'sC:\Users\hexat\scoop\apps\msys2\current
). You might want to declare the variable if not defined yet OR substitute it with full path. Pay attention onenv.PATH
too.On this line, it perpend
%PATH%
withmingw64
binaries.