Download and install the Build Tools for Visual Studio 2019. During installation select the C++ tools. It will download almost 5GB of data. Then restart the machine after installation and compiling the code will work fine.