Repeated link errors when inheriting from Actor/Pawn

I’ve been trying to go back to UE4, which I left a while ago, and I have trouble getting things running again.
When creating a new project and adding a new C++ class, the code will sometimes compile, sometimes throw a link error. The weird thing is that it does not do it all the time. But when it does it, no amount of regenerating the project files or restarting the engine will fix the problem, and the code won’t recompile properly again.

Here’s the latest case involving a simple inheritance from a Pawn:

Error MyPawn.cpp.obj : error LNK2019: unresolved external symbol "private: static class UClass * __cdecl AMyPawn::GetPrivateStaticClass(wchar_t const *)" (?GetPrivateStaticClass@AMyPawn@@CAPEAVUClass@@PEB_W@Z) referenced in function "public: static void * __cdecl AMyPawn::operator new(unsigned __int64,class UObject *,class FName,enum EObjectFlags)" (??2AMyPawn@@SAPEAX_KPEAVUObject@@VFName@@W4EObjectFlags@@@Z)

Error MyPawn.cpp.obj : error LNK2019: unresolved external symbol "public: __cdecl AMyPawn::AMyPawn(class FVTableHelper &)" (??0AMyPawn@@QEAA@AEAVFVTableHelper@@@Z) referenced in fonction "public: static class UObject * __cdecl AMyPawn::__VTableCtorCaller(class FVTableHelper &)" (?__VTableCtorCaller@AMyPawn@@SAPEAVUObject@@AEAVFVTableHelper@@@Z)

Does these references ring a bell to anybody?
I get similar types of errors 50% of the time when inheriting from actors. Did I forget something in the setup? I tried the same after reinstalling version 4.8.2, and 4.7.6 with the same results.