win10安装Rust+VS Code配置Rust环境

发布时间:2022-06-21 发布网站:脚本宝典
脚本宝典收集整理的这篇文章主要介绍了win10安装Rust+VS Code配置Rust环境脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。

目录
  • 下载rustup
  • 下载vs code
  • vs code配置
  • 常见问题

  • 笔记日期:2022年1月20日
  • Rust版本:1.58.0

Rust Playground(在线IDE):https://play.rust-lang.org/

下载rustup

进入:https://www.rust-lang.org/tools/install

点击“DOWNLOAD RUSTUP-INIT.EXE(64-BIT)”下载rustup并安装。默认安装会帮助我们安装:

  • stable-x86_64-pc-windows-msvc
  • cargo
  • clippy
  • rust-docs
  • rust-std
  • rustc
  • rustfmt

下载vs code

进入:https://code.visualstudio.com/

点击“Download for Windows”下载vs code并安装。

vs code配置

vs code中安装如下扩展:

  • rust-analyzer
  • CodeLLDB

常见问题

cargo run时报错:

PS D:projectshello_world> cargo run
   Compiling hello_world v0.1.0 (D:projectshello_world)
error: linker `link.exe` not found
  |
  = note: program not found

note: the msvc targets depend on the msvc linker but `link.exe` was not found

note: please ensure that VS 2013, VS 2015, VS 2017 or VS 2019 was installed with the Visual C++ option

error: could not compile `hello_world` due to previous error

解决办法:在终端依次运行如下两条指令:

rustup toolchain install stable-x86_64-pc-windows-gnu
rustup default stable-x86_64-pc-windows-gnu

脚本宝典总结

以上是脚本宝典为你收集整理的win10安装Rust+VS Code配置Rust环境全部内容,希望文章能够帮你解决win10安装Rust+VS Code配置Rust环境所遇到的问题。

如果觉得脚本宝典网站内容还不错,欢迎将脚本宝典推荐好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。
标签: