157 文字
1 分
Windowsでcargo build実行時にlinkerが見つからないエラーが発生した
状況
Windows で Rust をインストールして実行したら次のエラーが出た。
error: linker `link.exe` not found | = note: program not found
note: the msvc targets depend on the msvc linker but `link.exe` was not found
note: please ensure that Visual Studio 2017 or later, or Build Tools for Visual Studio were installed with the Visual C++ option.
note: VS Code is a different product, and is not sufficient.
対処法
エラーメッセージにある通り、Visual Studio 2017 以降、または Visual C++オプションをインストールした Build Tools for Visual Studio をインストールする必要がある。
次のコマンドでビルドツールをインストールする。
winget install Microsoft.VisualStudio.2022.BuildTools
Visual Studio Installer を起動して、「C++によるデスクトップ開発」を選択し変更を押す。 インストールの完了を待つ。
Windowsでcargo build実行時にlinkerが見つからないエラーが発生した
https://blog.ohirunewani.com/posts/rust-linker-not-found-on-windows/