Window上学习使用rust语言碰到linker `link.exe` not found | = note: program not foundnote: the msvc targe

在Windows上学习Rust遇到link.exe找不到的错误,通常需要安装VisualStudio或BuildTools。但文章提供了不依赖VS的解决方案:使用rustup安装稳定版的x86_64-pc-windows-gnu工具链,然后设置为默认,使程序正常运行。

按照rust的官方网站的指令开始学习rust,程序运行就会报错

linker `link.exe` not found | = note: program not foundnote: the msvc targe,具体报错如下:

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程序。

可以按照以下步骤来解决该问题:

  1. 访问Rust官方网站
评论 8
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值