Rust在windows下安装以后cargo build Error: linker `link.exe` not found

本文指导读者如何解决在Windows环境下使用Rust构建时遇到的link.exe缺失问题,通过下载并安装Visual C++ Build Tools,确保VS2013-2019版本已安装Visual C++选项,轻松修复编译难题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

问题示例:

D:\rust\runoob-greeting\greeting>cargo build
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

解决方法

下载,傻瓜式安装 visualcppbuildtools_full.exe
安装完成以后,成功运行
在这里插入图片描述

Microsoft Windows [版本 10.0.26100.4061] (c) Microsoft Corporation。保留所有权利。 C:\Users\32064>d: D:\>cd zluda D:\zluda>cd ZLUDA-master D:\zluda\ZLUDA-master>cargo build --release Compiling proc-macro2 v1.0.92 Compiling getrandom v0.3.3 Compiling serde v1.0.217 Compiling semver v1.0.23 Compiling syn v1.0.109 Compiling windows_x86_64_msvc v0.52.6 Compiling anyhow v1.0.89 Compiling num-traits v0.2.19 Compiling either v1.13.0 Compiling libc v0.2.171 Compiling version_check v0.9.5 Compiling hashbrown v0.15.2 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 Visual Studio 2017 or later, or Build Tools for Visual Studio were installed with the Visual C++ option. note: VS Code is a different product, and is not sufficient. error: could not compile `semver` (build script) due to 1 previous error warning: build failed, waiting for other jobs to finish... error: could not compile `serde` (build script) due to 1 previous error error: could not compile `proc-macro2` (build script) due to 1 previous error error: could not compile `getrandom` (build script) due to 1 previous error error: could not compile `syn` (build script) due to 1 previous error error: could not compile `anyhow` (build script) due to 1 previous error error: could not compile `windows_x86_64_msvc` (build script) due to 1 previous error error: could not compile `num-traits` (build script) due to 1 previous error error: could not compile `libc` (build script) due to 1 previous error
07-31
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值