2
votes

I installed the rust compiler and also MSVC v142 - VS 2019 C++ x64/x86 build tools (v14.27) (as an individual component) enter image description here

This does not seam to be working.

enter image description here

Does rust require anything more which I have not installed? Thank you in advance.

2
The following thread seems to be related: Unable to compile Rust hello world on Windows: linker link.exe not found. Perhaps it is of help.Jason
Although that is related, I am actually trying to find the minimum components for rust to work. It seems like the C++ build tools install lots of stuff.Cool Developer
Have you followed the instructions in this article?: Use the Microsoft C++ toolset from the command lineCoder-256

2 Answers

3
votes

Install the Windows SDK too.

I also didn't want to install all of Visual Studio just to compile rust from the command line.

Based on the info in coder-256's link, I tried running C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Auxiliary\Build\vcvars64.bat. Then, instead of being unable to find link.exe, I got the error: note: LINK : fatal error LNK1181: cannot open input file 'advapi32.lib'

Searching Stack for that error led to this answer: Install the Windows SDK

So I installed the Windows 10 SDK, and now (after launching a new cmd window) it works.

0
votes

Using Win11, here's the specific steps that worked for me (assumes VSCode and Rust are already installed):

  1. Go to the Visual Studio Download site
  2. Download Build Tools for Visual Studio 2019 (version 16.9)
  3. Install
  4. Create a "hello world" Rust project (cargo new hello)
  5. Open project in VSCode
  6. Set path info in launch.json file (located at folder root, may need to create this first)
  7. Type Shift+Ctrl+B to build the Rust project