๊ธฐ๋ณธ์ ์ผ๋ก code-runner๋ mingw (g ++)์ ๋ํด ๊ตฌ์ฑ๋ฉ๋๋ค.
_C ++ ๋น๋ ๋๊ตฌ (MSVC ๋๋ cl.exe)์ ๋ํด ์ด๋ป๊ฒ ๊ตฌ์ฑ ํ ์ ์์ต๋๊น? _
"cpp": "\"MyFolder \ VC \ bin \ amd64 \ vcvars64.bat \ "&& cd $ dir && cl $ fileName /fe$fileNameWithoutExt.exe && $ dir $ fileNameWithoutExt.exe",
๊ฐ์ฌ
์ฌ๊ธฐ ๋๋ฅผ ์ํด ์ผํ settings.json์ ๋ด์ฉ์ด ์์ต๋๋ค.
`{
"files.autoSave": "afterDelay",
"code-runner.runInTerminal": true,
"code-runner.executorMap": {
"python": "$pythonPath -u $fullFileName",
"cpp": " \"C:/Program Files (x86)/Microsoft Visual Studio/2019/BuildTools/Common7/Tools/VsDevCmd.bat\" && cd $dir && cl $fileName /fe$fileNameWithoutExt.exe && $dir$fileNameWithoutExt.exe ",
}
}`
์๋๋ VC ++ ์ค์ ์ ๋ํ VSCode์ ๊ณต์ ๋ฌธ์์์ ๋ณธ "/ Zi / EHsc / Fe :"์ธ์๋ฅผ ์ฌ์ฉํ ์ค์ ์
๋๋ค. VsDevCmd.bat์ ํ์ผ ๊ฒฝ๋ก๋ VS ๋ฒ์ ์ ๋ฐ๋ผ ๋ค๋ฅผ ์ ์์ต๋๋ค.
"code-runner.executorMap": {
"cpp": " \"C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/Common7/Tools/VsDevCmd.bat\" && cd $dir && cl $fileName /Zi /EHsc /Fe:$fileNameWithoutExt.exe && $dir$fileNameWithoutExt.exe ",
}
์ด๊ฒ์ ๊ธฐ๋ณธ ์ ธ ์ด PowerShell ๋ก ์ค์ ๋์์ ๋ ์ ์๊ฒ ๋์์ด๋๋ ์์ ์ ๋๋ค. ๋ช ๋ น ํ๋กฌํํธ (cmd.exe)์์๋ ์๋ํ์ง ์์ต๋๋ค ( VsDevCmd.bat ํ์ผ์ cmd.exe ์ฉ์ ). C ์ธ์ด ( "c")๋ก ์ค์ ํ์ง๋ง ์๋ง๋ C ++ ( "cpp")์์ ์๋ ํ ๊ฒ์ ๋๋ค.
"code-runner.executorMap": {
"c": "Import-Module \"C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/Common7/Tools/Microsoft.VisualStudio.DevShell.dll\"; Enter-VsDevShell 00595aab; cd $dir; cl $fileName && del $fileNameWithoutExt.obj && Clear-Host && Start-Process pwsh -ArgumentList \"-Command &{.\\$fileNameWithoutExt; pause}\"",
PowerShell ์ฉ ๋ช
๋ น ์ค :
Import-Module \"C:/Program Files (x86)/Microsoft Visual Studio/2019/Professional/Common7/Tools/Microsoft.VisualStudio.DevShell.dll\"; Enter-VsDevShell 00595aab
์์ฑ-> ๋์ ๋ด์ VS 2019 Windows ์์ ๋ฉ๋ด ๋ฐ๋ก ๊ฐ๊ธฐ Enter-VsDevShell ์๋ ๊ณ ์ ํ ID ๋ฒํธ๊ฐ ์์ต๋๋ค. ์์ ์ ๊ฒ์ ์ฌ์ฉํด์ผํฉ๋๋ค.
cmd.exe์ ๋ช
๋ น ์ค :
\"C:/Program Files (x86)/Microsoft Visual Studio/2019/Professional/Common7/Tools/VsDevCmd.bat\"
VS 2019 Windows ์์ ๋ฉ๋ด ๋ฐ๋ก ๊ฐ๊ธฐ์
๊ฐ์ฅ ์ ์ฉํ ๋๊ธ
์ฌ๊ธฐ ๋๋ฅผ ์ํด ์ผํ settings.json์ ๋ด์ฉ์ด ์์ต๋๋ค.
`{
"files.autoSave": "afterDelay",
"code-runner.runInTerminal": true,
}`