在执行 rustc 命令时出现以下错误提示,说明 Visual Studio C++ Build tools 没有安装。

E:\rust>hello_word>rustc main.rs
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

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

error: aborting due to previous error

首先要去下载 Visual Studio C++ Build tools,然后打开 visualcppbuildtools_full.exe 文件,选择 默认值 安装。

安装过程中如果提示“安装包丢失或损坏”,则需要通过下载离线包进行安装,百度网盘 - 提取码:6gfx

离线包为 .iso 文件,下载以后直接进行解压,然后回到安装界面,在“请提供搜索包的位置”中选择所对应提示的 .msi 文件,如: packages\BuildTools_MSBuild_amd64\BuildTools_MSBuild.msi ,点击“重试”按钮即可。

整个离线包大小在 1.08G 对没有百度网盘会员的人来说可能有些吃力,所以我把解压后 BuildTools_MSBuild_*** 相关的文件单独传了一份(只有4~8M),大家可以先尝试下载针对性的 压缩包 ,如果不行再下载完成的。

感谢您的阅读,本文由 蓝色梦想 版权所有。如若转载,请注明出处:蓝色梦想 - Rust 在 Windows10 下安装/执行出错的解决方法