Невозможно скомпилировать Rust hello world в Windows: linker link.exe не найден - PullRequest
7 голосов
/ 10 апреля 2019

Я установил Rust на 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!");
}

1 Ответ

12 голосов
/ 10 апреля 2019

Я скачал и установил Инструменты сборки для Visual Studio 2019 . Во время установки я выбрал C ++ tools . Было загружено почти 5 ГБ данных. Я перезапустил машину после установки и компиляция кода работала нормально:

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