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-2024 CODEPRJ.COM