/VSCode-WSL-Run

Build source file in WSL and run binary file

Primary LanguageC++MIT LicenseMIT

WSL-Run

调用WSL编译运行代码文件,支持c、cpp、java、python

使用方法

Step 1 安装WSL

请参考官方安装指南

Step 2 在WSL中安装编译环境

sudo apt install build-essential
sudo apt install openjdk-8-jdk
sudo apt install python3

Step 3 安装VSCode

请到VSCode官网下载安装适合的Windows版本

Step 4 安装插件 Launcher

Step 5 下载 VSCode-WSL-Run

git clone --depth=1 https://github.com/SunYufei/VSCode-WSL-Run

将VSCode-WSL-Run文件夹添加到系统环境变量中

Step 6 VSCode 设置

点击文件->首选项->设置,在用户设置中添加

"launcher.terminal": {
    "executable": "cmd.exe",
    "parameters": "/c start bashrun.exe \"%item%\""
}

Step 7 使用

使用VSCode打开源代码文件,按下Ctrl+Shift+T即可编译运行单一代码文件

致谢

SilenceU's Blog

vscode-launcher