Window上rust语言碰到the msvc targets depend on the msvc linker but `link.exe` was not found

或者是报错如下:

cargo run
   Compiling hello-rust v0.1.0 (D:\gantStudyDemo\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 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. 

错误原因

这个错误表明编译Rust程序时没有找到MSVC linker,需要通过安装Visual Studio 2017或更高版本或Visual Studio Build Tools解决该问题。这是因为Rust编译器通常使用Microsoft的C++编译器来编译Rust程序。

可以按照以下步骤来解决该问题:(不推荐用下面的方式)

访问Rust官方网站下载安装 Rust。
通过Rust官方指南中的步骤,检查您的安装是否成功。
如果您没有安装Visual Studio或Build Tools,则需要 下载并安装 Visual Studio 2017或更高版本 或 Build Tools for Visual Stu

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
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

1024小神

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值