I know there are tons of similar stackoverflow topics already, but I still can't fix my own case and I need help.
I'm using windows 11, with both 2019 and 2022 Visual Studio Build Tools installed.
PS C:\Users\Username\Development\dogcat> winget list | Select-String "build tools"
Visual Studio Build Tools 2019 Microsoft.VisualStudio.2019.BuildTools 16.11.33 winget
Visual Studio Build Tools 2022 Microsoft.VisualStudio.2022.BuildTools 17.8.6 winget
and also have Visual Studio 2022, Visual C++ installed.
PS C:\Users\Username\Development\dogcat> winget list | Select-String "Visual Studio Community"
Visual Studio Community 2022 (2) Microsoft.VisualStudio.2022.Community 17.9.1 winget
PS C:\Users\Username\Development\dogcat> winget list | Select-String "VCRedist"
Microsoft Visual C++ 2015-2022 Redistrib… Microsoft.VCRedist.2015+.x86 14.38.33135.0
winget
Microsoft Visual C++ 2015-2022 Redistrib… Microsoft.VCRedist.2015+.x64 14.38.33135.0
winget
for Rust compiler, this
PS C:\> winget list | Select-String "Rust"
Rust 1.76 (MSVC 64-bit) Rustlang.Rust.MSVC 1.76.0.0 winget
I previously tried the same thing using rustup package (from winget) and got the same result.
all via winget. And I'm getting the following error.
PS C:\Users\Username\Development\dogcat> cargo run
Compiling dogcat v0.1.0 (C:\Users\Username\Development\dogcat)
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.
error: could not compile `dogcat` (bin "dogcat") due to 1 previous error
fdfind search for link.exe from root gives me nothing valuable
PS C:\> fd link.exe
Program Files\Rust stable MSVC 1.76\lib\rustlib\x86_64-pc-windows-msvc\bin\gcc-ld\lld-link.exe
Program Files\Git\usr\bin\unlink.exe
Program Files\Git\usr\bin\readlink.exe
Program Files\Git\usr\bin\link.exe
Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\Git\usr\bin\readlink.exe
Also, I went over this Microsoft official page for installing Windows SDK for Windows 11. What am I doing wrong here?
I tried all things written in some GitHub issues and stackoverflows for this error. I even restarted my computer several times (which I think is a waste of time). Still no hope.
I ended up installing C++ Desktop development kit from visual studio installer, which was a hard decision for me. I wanted to manage everything from inside winget, but I guess that's not viable, as long as you are using Windows.
Plus, you shouldn't install Rust(MSVC) package for rust because packages like rustfmt are installed from rustup.