gpt4 book ai didi

compiler-errors - 无法在 Windows 上编译 Rust hello world : linker link. 找不到 exe

转载 作者:行者123 更新时间:2023-11-29 07:41:30 27 4
gpt4 key购买 nike

我从 Rust installation page 开始在 Windows 上安装了 Rust .安装后,我尝试运行“hello world”程序,但出现以下错误。

>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!");
}

最佳答案

我下载并安装了 Build Tools for Visual Studio 2019 .在安装过程中,我选择了 C++ 工具。它下载了将近 5GB 的数据。安装后我重新启动机器并编译代码工作正常:

> 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!

关于compiler-errors - 无法在 Windows 上编译 Rust hello world : linker link. 找不到 exe,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55603111/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com