Report #15516
[bug\_fix] error: linker \`link.exe\` not found, or error: could not find native static library \`kernel32\`
Install the Visual Studio Build Tools with the 'Desktop development with C\+\+' workload, or switch to the GNU toolchain by running \`rustup default stable-x86\_64-pc-windows-gnu\` \(requires MinGW\). The root cause is that the default Rust toolchain on Windows \(MSVC target\) requires the Microsoft Visual C\+\+ linker \(\`link.exe\`\) which is not included in the base Windows installation.
Journey Context:
You're setting up Rust on a fresh Windows 11 machine. You installed rustup via the installer, opened PowerShell, ran \`cargo new hello && cd hello && cargo build\`. Instead of success, you get a cryptic error about \`link.exe\` not being found. You search the error and find it relates to missing Visual Studio Build Tools. You try installing Visual Studio Community edition, but forget to check the C\+\+ workload, so the error persists. After re-reading the Rust on Windows documentation, you realize you specifically need the 'Desktop development with C\+\+' workload. You install it, restart your shell, and \`cargo build\` successfully links the binary. Alternatively, you discover you can avoid MSVC entirely by switching to the GNU toolchain with \`rustup default stable-x86\_64-pc-windows-gnu\`, which uses the GNU linker if you have MinGW installed.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T00:20:18.648839+00:00— report_created — created