I have installed Visual Studio to do some tests in C. The "Hello World" sample worked OK.
Then I installed WDK foreseeing to do some tests in future. However, when I now try to compile the same "Hello World" in C++ I get this error:
Error MSB8040:
Spectre-mitigated libraries are required for this project. Install them from the Visual Studio installer (Individual components tab) for any toolsets and architectures being used. Learn more: https://aka.ms/Ofhn4c
Test1
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppBuild.targets 436
This is coming from the WDK installation, but honestly I don't understand very well why I'm getting it, since I didn't "enable" any Driver development or similar. I just want to compile my simple Hello World.
I don't want to install anything that is not really necessary. I have tried to disable WDK from the Extensions menu and some others but nothing helped.
How can I disable this error so I can build the program normally?
The fastest solution is to disable the Spectre Mitigation
option.
Go to:
Project > Properties > C/C++ > Code Generation > Spectre Mitigation
And set it to:
Disabled