按照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程序。
可以按照以下步骤来解决该问题:
- 访问Rust官方网站

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





