Windows上的Rust编译错误:找不到链接器link.exe
大家好!我刚开始学习Rust,在尝试编译最简单的"Hello, world!"程序时遇到了问题。
我通过rustup-init.exe安装了Rust,一切顺利。使用`cargo new hello_world`创建了一个新项目,然后进入了项目文件夹。在main.rs文件中,我有以下代码:
```rust
fn main() {
println!("Hello, world!");
}
```
尝试通过`cargo build`编译时,出现了错误:
```
error: linker `link.exe` not found
|
= note: The system cannot find the file specified. (os error 2)
```
我使用的是Windows 10 64位系统。看起来Rust找不到链接器。我尝试过重新安装Rust,但没有帮助。网上说需要安装Visual Studio或Build Tools,但我不确定具体该安装什么以及选择哪些组件。请问如何解决这个问题?有没有办法不安装Visual Studio?我非常想开始用Rust编程,但这个错误阻止了我。提前感谢!