Some time ago, I, like many of you moved to Visual Studio 2022. It works great with C# and eventually, I decided to move C++ activities to VS 2022 as well. After I installed everything, I created C++ Console Application and I try to compile it. To my surprise, it didn’t work, and got the following message:
C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.32.31326\include\yvals.h(12,10): fatal error C1083: Cannot open include file: 'crtdbg.h': No such file or directory
After some research, I found an article that helped me. For some reason, there is an invalid path to Windows SDK in the registry. To fix this issue you need to go to this registry key:
Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows Kits\Installed Roots
And change the value for key KitsRoot10 from C:\Program Files\Windows Kits\10\ to C:\Program Files (x86)\Windows Kits\10\ and then everything will start to work properly.
I have no idea why this registry value changed but I hope it will help someone.