Member-only story

Rust with Visual Studio Code on Windows from Ubuntu

a quick way to avoid MS build toolchain

circuit4u
1 min readOct 2, 2021

--

Say you want to play with Rust on a Windows machine.

Rust comes with a native installer for Windows, but that requires you to download and install MS C/C++ build tools first (several GB).

Here is a quick way to avoid doing that.

  1. On Windows side, make sure WSL remote is added-on your Visual Studio Code
  2. install Ubuntu on WSL2
  3. Then terminal into Linux side, install Rust on the Linux side, and remember to install “build-essential” (compiler tool chain on Linux)
  4. run Visual Studio Code (code .) in the Linux terminal; a VSCODE window will pop-up as a Windows program, and it remotes to the Linux side.
  5. Now you can compile and run Rust code in VSCODE; it’s going to be compiled for Linux with the Linux compiler tool chain.

Key advantages:

  • No need for GB sized MS C/C++ compiler toolchain; Rust toolchain resides on Linux side; Linux is just a Rust compiler and runtime.
  • The source code files are kept in Windows folders, in case WSL2 goes nuts.

--

--

circuit4u
circuit4u

Written by circuit4u

memento of electronics and fun exploration for my future self

No responses yet