VScode 配置rust開發環境


記錄一下在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配置

​ 安裝三個插件

  1. Rust for Visual Studio Code

  2. rust-analyzer

  3. 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}"
        }
    ]
}


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM