Can't Open C++ when trying to start new project, but can open blueprint just fine

I just reinstalled UE5 and and installed the latest version (2022) of visual studio, and then it worked.