2022年5月24日 星期二

Rust 的“error: linker `link.exe` not found”錯誤

這是照著官網的新手入門,一步一步來時發生的問題。

照著官網建立hello-rust專案後,執行cargo run,就會跳出以下錯誤(我的環境是 win10)

C:\hello-rust> cargo run
   Compiling hello-rust v0.1.0 (C:\hello-rust)
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, VS 2019 or VS 2022 was installed with the Visual C++ option

error: could not compile `hello-rust` due to previous error