VScode 配置rust開發環境
阿新 • • 發佈:2020-09-15
記錄一下在Visual Studio Code中配置Rust debug模式。
Rust 版本
安裝Rust,具體到官網下載 https://www.rust-lang.org/,
由於我在windows環境上,因此安裝了msvc版本
Default host: x86_64-pc-windows-msvc
rustup home: D:\Users\xxx\.rustup
stable-x86_64-pc-windows-msvc (default)
rustc 1.46.0 (04488afe3 2020-08-24)
cargo 1.46.0 (149022b1d 2020-07-17)
用Cargo執行如下命令新建工程
PS D:\vstest\main> cargo new RustDemo
Created binary (application) `RustDemo` package
VSCode配置
安裝三個外掛
-
Rust for Visual Studio Code
-
rust-analyzer
-
Native Debug
修改launch.json
/* launch.json */ { // Use IntelliSense to learn about possible attributes. // Hover to view descriptions of existing attributes. // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 "version": "0.2.0", "configurations": [ { "name":"(Windows) Launch" "type":"cppvsdbg", "request": "launch", "program": "${workspaceFolder}/target/debug/RustDemo.exe", "args": [], "cwd": "${workspaceFolder}" } ] }