公式サイトの手順に従ってインストールし、実行してください。
> cargo build
Compiling rust-demo v0.1.0 (E:\rust\rust-demo)
error: linker `link.exe` not found
|
= note: 系统找不到指定的文件。 (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, VS 2017 or VS 2019 was installed with the Visual C++ option
error: aborting due to previous error
error: could not compile `rust-demo`.
To learn more, run the command again with --verbose.
このエラーについてはさまざまな意見がありますが、状況を考慮すると、おそらくそれらは問題ないでしょう。しかし、いろいろな方法を試しましたが無駄でした。
最終的解決:
1. Microsoft の公式 Web サイトにアクセスして、vs_community__1980043881.1626916635.exe をダウンロードします (次の数字はバージョン番号であるため、心配しないでください)。
2. 下の図の赤いボックスを選択してインストールし、コンピューターを再起動します。
どうしても Visualcppbuildtools_full.exe をインストールしようとすると、多くの問題が発生してインストールできない可能性があります。このように処理する方が簡単です。