win10安裝Rust+VS Code配置Rust環境


  • 筆記日期: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:\projects\hello_world> cargo run
   Compiling hello_world v0.1.0 (D:\projects\hello_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


免責聲明!

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



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