Hey sorry I know this is an old thread just wanted to mention for anyone else that stumbles across here.
A lot of the time when you get the error on GENERATED_BODY() in the .h file, and BeginPlay(), TickComponent() in the .cpp, but Unreal Engine still compiles fine, you just need to refresh the project. To fix and get rid of the errors, save all your files and anything open in Unreal, close it all down. Now go to that projects folder on your PC, and delete the Binaries folder. Once that’s done you can reopen the project and unreal will recreate the Binaries for you. In the Unreal Engine now, click file>Refresh Visual Studio. Now when you open your code again the errors should be gone.
Hope this helps someone!