第一步在WSL中配好環境c++
第二步安裝CodeRunner便可,在用戶配置中加入以下行:shell
"terminal.integrated.shell.windows": "C:\\WINDOWS\\System32\\bash.exe",//設置內置終端爲WSL "code-runner.runInTerminal": true,//使用內置終端 "code-runner.saveFileBeforeRun": true,//運行前保存 "code-runner.clearPreviousOutput": true,//運行前清理舊的輸出文件 "code-runner.ignoreSelection": true,//忽略用戶選擇 "code-runner.preserveFocus": false,//運行時焦點跳回編輯器
以後,只要在WSL裝好能正確運行的環境就能夠了。能夠經過改變"code-runner.executorMap"
來設定一些終端中編譯文件的執行命令,如windows
"c": "cd $dirWithoutTrailingSlash && gcc $fileName -o $fileNameWithoutExt -std=c11 -lm && echo '[Running]' && ./$fileNameWithoutExt", "cpp": "cd $dirWithoutTrailingSlash && g++ -Wall $fileName -o $fileNameWithoutExt -std=c++11 -lm && echo '[Running]' && ./$fileNameWithoutExt"