无法在Windows上编译Rust hello world:找不到链接器link.exe [英] Unable to compile Rust hello world on Windows: linker link.exe not found
本文介绍了无法在Windows上编译Rust hello world:找不到链接器link.exe的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我已经从 Rust安装页面在Windows上安装了Rust.安装后,我尝试运行"hello world"程序,但出现以下错误.
I have installed Rust on windows from Rust installation page. After installation I tried running the "hello world" program but got the following error.
>cargo run
错误
Compiling helloworld v0.1.0 (C:\Users\DELL\helloworld)
error: linker `link.exe` not found
note: The system cannot find the file specified. (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 or VS 2017 was installed with the Visual C++ option
error: aborting due to previous error
error: Could not compile `helloworld`.
To learn more, run the command again with --verbose.
代码:
fn main() {
println!("Hello, world!");
}
推荐答案
I downloaded and installed the Build Tools for Visual Studio 2019. During installation I selected the C++ tools. It downloaded almost 5GB of data. I restarted the machine after installation and compiling the code worked fine:
> cargo run
Compiling helloworld v0.1.0 (C:\Users\DELL\helloworld)
Finished dev [unoptimized + debuginfo] target(s) in 12.05s
Running `target\debug\helloworld.exe`
Hello, world!
这篇关于无法在Windows上编译Rust hello world:找不到链接器link.exe的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文