Rust 版本

安装Rust,具体到官网下载 https://www.rust-lang.org

我是在windows环境上,且我已经安装了Visual Studio 2019,所以可以省了安装MSVC,直接安装Rustup即可,安装版本如下:

  1. cargo 1.49.0 (d00d64df9 2020-12-05)

用Cargo运行如下命令新建工程

  1. PS D:\vstest\main> cargo new hello_cargo
  2. Created binary (application) `hello_cargo` package

VSCode配置

安装三个插件

  1. Rust for Visual Studio Code
  2. rust-analyzer
  3. Native Debug
    修改launch.json
    1. /* launch.json */
    2. {
    3. // Use IntelliSense to learn about possible attributes.
    4. // Hover to view descriptions of existing attributes.
    5. // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    6. "version": "0.2.0",
    7. "configurations": [
    8. {
    9. "name":"(Windows) Launch"
    10. "type":"cppvsdbg",
    11. "request": "launch",
    12. "program": "${workspaceFolder}/target/debug/hello_cargo.exe",
    13. "args": [],
    14. "cwd": "${workspaceFolder}"
    15. }
    16. ]
    17. }