error: linker `link.exe` not found | = note: The system cannot find the file specified.

Question 1: An error message "error: linker link.exenot found
|
= note: The system cannot find the specified file. (os error 2)"

PS C:\Users\sun\Desktop\runoob-greeting> cd .\greeting
PS C: \Users\sun\Desktop\runoob-greeting\greeting> cargo build
Compiling greeting v0.1.0 (C:\Users\sun\Desktop\runoob-greeting\greeting)
error: linker link.exenot found
|
= note: The system cannot find the specified document. (os error 2)
note: the msvc targets depend on the msvc linker but link.exewas not found

The background to the problem appears in : Rust's build tool and package management tool - Cargo

Solution:
Install Visual Studio 2019 build tools Visual Studio 2019 build tools or Microsoft Visual Studio. After downloading the build tools, select only "C++ Build Tools" in the Visual studio installer, then select only "MSVC v142 - VS2019 C++ x64/x86 Build Tools".
Specific process and download address reference blog: https://blog.csdn.net/coolsoloist/article/details/106425656

Appendix:
1. Rust environment setup
https://www.runoob.com/rust/rust-setup.html
2. Use Rust to create a new project
https://blog.csdn.net/weixin_28934777/article/details/112286569

Guess you like

Origin blog.csdn.net/woshisunyizhen/article/details/116209683