Adding any new c++ class causes compile error in Engine code

Despite the compiler errors, I am certain playerstate.h is not the source of the problem for a couple of reasons:

  • as I mentioned, this is an unmodified engine source file that is read-only. It’s complaining about the syntax of the ClientInitialize function, which is fine.

  • the compile error shows up immediately when adding any new empty C++ class, completely unrelated to playerstate, no headers, references, etc. There were never any problems adding new classes until recently.

  • the same type of error has been reported before by another user with a different class other than playerstate: Creating new C++ class leads to compile error. As this user mentions, I suspect the issue is the init.gen.cpp files are not being properly generated, I just don’t understand why or what could have caused things to break.

Interestingly, I was able to recreate the error in a fresh UE 5.2 project that was empty except for the source files I copied over.