"link.exe" not found but "Desktop Development with C++" selected but installation warning

Hi, I'm new to Rust and installed as recommended (on Windows 10), but Visual Studio 2022 17.8.3 returns with a warning during setup:

"Couldn’t install Microsoft.VisualCpp.Redist.14"

Finally I get

rustc main.rs
linker `link.exe` not found

I did a Visual Studio 2022 support ticket here
https://developercommunity.visualstudio.com/t/post/10548353
with all detailed information. Please take a look there!

I'm not sure if the setup problem is the problem the "link.exe" can't be found.

Of course PC restarted incl. DOS. Tried it multiple times with uninstall and clean-up. No chance to use the MSVC. When I switch to GNU it works which is ok for learning but not for my final project.

I found and read many posts about link.exe but none seems to have my problem and how to fix. Still waiting for VS people reply. Maybe Rust community knows more if the warning results in the problem.

Thanks

this warning should not affect the visual studio C++ toolchain I think. after the intallation, are you able to use Visual Studio to build C++ program?

can you try it inside the Developer Command Prompt for VS 2022? maybe the toolchain installed sucessfully but the environment variable didn't setup correctly.

Thanks a lot. I've to try a C++ program later.

May I ask you which environment variables should be set? By Visual Studio 2022? So they should be set permanent as admin?

I've looked around but no environment variables are set or changed so far.

In case of problems I can try to set them manually.

the directory containing the link.exe program (it should be some subdirectory of %VCToolsInstallDir%\bin, and it should also contain other tools like cl.exe, lib.exe etc) should be added to the PATH variable, which allows you invoke the link.exe directly from the command prompt

no, because Visual C++ can install multiple toolchains for different host and target variants, and that's why the installer does not set the environment variables globally, but instead create shortcuts for multiple shell scripts like "x86 native tools command prompt", "x86_x64 cross tools command prompt" etc., those scripts will setup environments for different toolchains accordingly.

so if you can build C++ projects successfully, the toolchain should be working, try to build your rust project under the "Developer Command Prompt for VS2022".

you can manually add the build toolchain to PATH variable, but it is not necessary, IIRC, rustup can detect Visual C++ installations from the Windows registry.

so if you find your Visual C++ works as expected, you may try to re-install the rust toolchain using rustup.

Thanks a lot.

After fixing the Visual Studio 2022 setup - I did various standalone steps and a repair step - the "rustup-init.exe" detected MSVC.

If someone has the same problem - please see:
Visual Studio Developer Community

Now the challenge can continue. :grinning:

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.