UE 5.5.4 can't find visual studio 2022

I’m trying to convert my blueprint only project to c++ project so when I try to add a class, ue gives me an error. I have tried uninstalling and reinstalling both ue5.5.4 and visual studio 2022, redid most recent windows sdk setup. Engine still can’t find the compiler. I had some other errors show up too:

(microsoft.visualstudio.component.windows10sdk.18362: couldn’t find a matched package)

I also tried to repair the visual studio setup on the vs downloader, but when I restarted my pc to finish the process it said that there was an error so it couldn’t repair.

I’m using windows 10 and both UE5.5.4 and visual studio 2022 are downloaded on my D drive.