Vscode-code-runner: C ++ ๋นŒ๋“œ ๋„๊ตฌ (MSVC) ์šฉ ์ฝ”๋“œ ๋Ÿฌ๋„ˆ ๊ตฌ์„ฑ

์— ๋งŒ๋“  2018๋…„ 07์›” 13์ผ  ยท  5์ฝ”๋ฉ˜ํŠธ  ยท  ์ถœ์ฒ˜: formulahendry/vscode-code-runner

๊ธฐ๋ณธ์ ์œผ๋กœ code-runner๋Š” mingw (g ++)์— ๋Œ€ํ•ด ๊ตฌ์„ฑ๋ฉ๋‹ˆ๋‹ค.

_C ++ ๋นŒ๋“œ ๋„๊ตฌ (MSVC ๋˜๋Š” cl.exe)์— ๋Œ€ํ•ด ์–ด๋–ป๊ฒŒ ๊ตฌ์„ฑ ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๊นŒ? _

fyi question

๊ฐ€์žฅ ์œ ์šฉํ•œ ๋Œ“๊ธ€

์—ฌ๊ธฐ ๋‚˜๋ฅผ ์œ„ํ•ด ์ผํ•œ 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 ",
}

}`

๋ชจ๋“  5 ๋Œ“๊ธ€

"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 ์‹œ์ž‘ ๋ฉ”๋‰ด ๋ฐ”๋กœ ๊ฐ€๊ธฐ์—

์ด ํŽ˜์ด์ง€๊ฐ€ ๋„์›€์ด ๋˜์—ˆ๋‚˜์š”?
0 / 5 - 0 ๋“ฑ๊ธ‰