I have a Rust project that compiles okay on Linux, macOS, and Windows 10.
I installed the following individual components on my Windows 7 computer today using the Visual Studio Installer:
VC++ 2015.3 v14.00 (v140) toolset for desktop
Windows Universal CRT SDK (Dependency)Windows 8.1 SDK (Dependency)After that, I installed Rust using a fresh rustup-init.exe from the official website.
When I run cargo build on my Rust project on the Windows 7 computer, it fails with the following message:
error: linking with `C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\amd64\link.exe\` failed: exit code: 325595.
Running C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\amd64\link.exe all on its own with no arguments on my Windows 10 computer produces some "help" information, but on my Windows 7 computer, I get a window with the error message:
The application was unable to start correctly (0xc000007b). Click Ok to close the application.
My Google-Fu hasn't turned up any useful information. I've tried:
sfc /scannowChanging the default linker solves this issue. My system is a 64 bit one but the linker was pointing to a 32 bit one.
This is also mentioned in the rust book
rustup default stable-x86_64-pc-windows-gnu
Read this for more explanation on why this happens.
By default, the configuration chose it for 32 bit so running the command given above will switch the linker for 64 bit.
After downloading the latest 64-bit runtime Visual C++ Redistributable for Visual Studio 2017, link.exe works on my Windows 7 computer. I can now compile my Rust project.
I'm surprised that the Visual Studio Installer doesn't ensure that the necessary runtime components are installed for the 2015 toolset.
Update: Stargateur pointed out that the Redistributable can be installed directly from the Visual Studio Installer.
It is the Visual C++ 2017 Redistributable Update individual component.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With