I use CodeRunner for VSCode on Windows, so I need to change g++ to MSVC (Visual C++ Compiler).
So I configure settings.json
for coderunner:
{
"window.zoomLevel": 0,
"code-runner.runInTerminal": true,
"terminal.integrated.shell.windows": "cmd.exe",
"code-runner.executorMap": {
"cpp": "vcvars64.bat && cl.exe $fileName && del $fileNameWithoutExt.obj && cls && $fileNameWithoutExt.exe",
},
"files.autoSave": "afterDelay"
}
As you can see, I add path of vcvars64.bat to system PATH. It works, but after several runs I get next error:
Input line is too long.
I search for it and found that it is because CodeRunner run vcvars64.bat every time! So after several runs total path become too long:
"Input line is too long" error in BAT File
Restarting console clear it, but after several runs falls again.
Looks like I need to find some way to use vcvars64.bat
only once but I don't know how!