Chỉnh sửa

Chia sẻ qua


Set up your Rust development environment on Windows

Step 1: Install the MSVC C++ Build Tools

Rust on Windows requires Microsoft's C++ build tools as a prerequisite. If you already have Visual Studio installed with the Desktop development with C++ workload, you can skip this step.

Otherwise, install the Microsoft C++ Build Tools and select the Desktop development with C++ workload.

Note

Use of the Microsoft C++ Build Tools requires a valid Visual Studio license (Community, Pro, or Enterprise). The Community edition is free for students, open-source contributors, and individuals.

Step 2: Install Rust

The official Rust installer, rustup, handles everything — the compiler, Cargo, and future updates.

winget install Rustlang.Rustup

After installation, open a new terminal and verify your setup:

cargo --version
rustc --version

Tip

To keep Rust up to date, run rustup update periodically.

Step 3: Install Visual Studio Code and the Rust extension

  1. Download and install Visual Studio Code.
  2. Install the rust-analyzer extension from the VS Code Marketplace. This adds code completion, inline errors, go-to-definition, and debugging support.

Next steps