Report #92895
[bug\_fix] linker \`link.exe\` not found
Install Visual Studio Build Tools with the 'Desktop development with C\+\+' workload to obtain the MSVC toolchain including \`link.exe\`, or switch to the GNU toolchain by running \`rustup default stable-x86\_64-pc-windows-gnu\` \(requires MinGW/MSYS2 installation\). Root cause: The default Windows target for Rust \(x86\_64-pc-windows-msvc\) requires Microsoft's C\+\+ linker which is not included in a standard Windows installation, unlike Linux systems which typically include ld.
Journey Context:
Developer installs Rust on a fresh Windows 11 machine using rustup-init.exe and selects the default stable toolchain. They create a new project with \`cargo new hello\_world\` and immediately run \`cargo build\`. The build fails with 'error: linker \`link.exe\` not found'. The developer searches the error message online and finds the Rust installation documentation. They learn that unlike on Linux where a C linker is usually present, Windows requires either the Microsoft Visual C\+\+ Build Tools or a switch to the GNU toolchain. They initially try to install just the Windows SDK, which proves insufficient as it doesn't include the C\+\+ compiler and linker. They then download the Visual Studio Build Tools 2022 installer and select the 'Desktop development with C\+\+' workload, which installs \`link.exe\` and the necessary libraries. After restarting their terminal to refresh the PATH environment variable, \`cargo build\` succeeds. They note that they could have alternatively switched to the \`stable-x86\_64-pc-windows-gnu\` toolchain to use GCC instead, but the MSVC toolchain is generally preferred for interoperability with other Windows libraries.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T14:30:50.071927+00:00— report_created — created