问题1:出现报错“error: linker link.exe
not found
|
= note: 系统找不到指定的文件。 (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.exe
not found
|
= note: 系统找不到指定的文件。 (os error 2)
note: the msvc targets depend on the msvc linker but link.exe
was not found
问题背景出现在:Rust 的构建工具和包管理工具 - Cargo
解决办法:
安装Visual Studio 2019 生成工具Visual Studio 2019 build tools或者微软Visual Studio。下载build tools之后,在Visual studio installer中只选择“C++生成工具”,然后只选择"MSVC v142 - VS2019 C++ x64/x86 生成工具"。
具体流程和下载地址参考博客:https://blog.csdn.net/coolsoloist/article/details/106425656
附录:
1.Rust环境搭建
https://www.runoob.com/rust/rust-setup.html
2.使用Rust创建新项目
https://blog.csdn.net/weixin_28934777/article/details/112286569