Cannot open source file name.generated.hc

I had the same issue as well, I tried deleting all the files and rebuilding but it still didn’t work.
Later I noticed in VS output log “XYZ.generated.h file should always be the last”, I noticed that I had added another #include line after #include “XYZ.generated.h” which caused the error.