问题
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 desktopWindows 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 /scannow- ensure System32 doesn't have 32-bit DLLs
- ensure SysWOW64 doesn't have 64-bit DLLs
回答1:
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.
来源:https://stackoverflow.com/questions/50337099/cargo-build-fails-with-linking-error-link-exe-failed-exit-code-325595