Link,exe missing

Helli Rust Devs, I have an error when I start to compile the project, about a missing file "link.exe". I have reinstalled the rust toolchain but the error still persists

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 `Fundamentals` (bin "Fundamentals") due to 1 previous error

How can I resolve it?

The answer is, quite literally, written right there, in the message you quoted.

On windows link.exe doesn't come with operation system, you have to install Visual Studio (not Visual Studio Code, that's entirely different product, be sure to thank Microsoft for naming two absolutely unrelated products almost identially… Microsoft does that regularly) or Build Tools for Visual Studio — exactly like message says.

I figured it out thanks. Think I was just exhausted

I'd recommend downloading Build Tools, because it takes less disk space than the Visual Studio install. Just letting people know because the link to download Build Tools is hard to find.

If the anchor in the link gets broken, you can find it by scrolling to "Tools for Visual Studio" under "All downloads", then expanding the menu item.

1 Like

As pointed out already you need the build tools (which easily can be installed through the Visual Studio installer) - I wanted to add you have to make sure you install the tools for C++.

It's a stupid problem, I solved it a year ago.