Error every time I start a new VS project "Spectre-mitigated libraries are required for this project."

1.1k views Asked by At

Whenever I start a new C++ project on Visual Studio and compile, I am faced with this error. I then have to go to settings and disable spectre mitigation.

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/Ofhn4c2_Beginner-IntermediateC++

C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft
VC\v160\Microsoft.CppBuild.targets 428

Is there a way to have this option disabled automatically by default?

Why is this option enabled for me by default? I think I may have messed up an installation somewhere along the way as I don't see many posts about this online.

What I have to do every time to fix it

Note: I remember trying to install the libraries it's suggesting but there was around a dozen of them and they didn't seem to be making a difference. It was a long time ago though and I may have made a mistake. I will try again.

1

There are 1 answers

1
Eon On

Ok thanks to @dxiv I managed to solve this issue, i.e. now my new C++ projects on Visual Studio have Spectre Mitigations OFF by default and I don't have to manually disable it every time I create a new project.

First I uninstalled WDK, it did not solve the issue.

Then on Visual Studio Installer > Modify > under Individual Components > Untick box that says WDK (3MB) > Modify. This will remove that WDK component. And now the spectre mitigation is off by default.

The solution could be due to both of the steps I mentioned but probably it was enough to just remove that component from Visual Studio Installer.