Download

Added a class and now my project won't compile

  • Engine Version: 4.13.2 (From Source)
  • Additional Dependencies: Xbox Source
  • Visual Studio Version: 2015 Pro
  • OS: Windows 10

Today I added a couple new C++ classes to my project (there were already several, which had no issues compiling before) and now my project will no longer compile:

The two classes were called:

  1. Game
  2. JSONContainer

The project breaks when trying to compile the PCH.ProjectName.h.cpp file with a whole bunch of errors from the engine source:



2>  Performing 7 actions (4 in parallel)
2>  PCH.ProjectName.h.cpp
2>c:\unreal\4132\engine\source\runtime\engine\public\ComponentInstanceDataCache.h(35): error C2061: syntax error: identifier 'FReferenceCollector'
2>c:\unreal\4132\engine\source\runtime\engine\public\ComponentInstanceDataCache.h(39): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
2>c:\unreal\4132\engine\source\runtime\engine\public\ComponentInstanceDataCache.h(39): error C2143: syntax error: missing ';' before '*'
2>c:\unreal\4132\engine\source\runtime\engine\public\ComponentInstanceDataCache.h(39): error C2334: unexpected token(s) preceding '{'; skipping apparent function body
2>c:\unreal\4132\engine\source\runtime\engine\public\ComponentInstanceDataCache.h(52): error C2079: 'FActorComponentInstanceData::SavedProperties' uses undefined class 'TArray<uint8,FDefaultAllocator>'
2>c:\unreal\4132\engine\source\runtime\engine\public\ComponentInstanceDataCache.h(37): error C2228: left of '.Num' must have class/struct/union
2>  c:\unreal\4132\engine\source\runtime\engine\public\ComponentInstanceDataCache.h(37): note: type is 'const int'
2>c:\unreal\4132\engine\source\runtime\engine\public\ComponentInstanceDataCache.h(78): error C2061: syntax error: identifier 'FReferenceCollector'
2>c:\unreal\4132\engine\source\runtime\engine\public\ComponentInstanceDataCache.h(82): error C2079: 'FComponentInstanceDataCache::ComponentsInstanceData' uses undefined class 'TArray<FActorComponentInstanceData *,FDefaultAllocator>'
2>c:\unreal\4132\engine\source\runtime\engine\public\ComponentInstanceDataCache.h(84): error C2065: 'USceneComponent': undeclared identifier
2>c:\unreal\4132\engine\source\runtime\engine\public\ComponentInstanceDataCache.h(84): error C2059: syntax error: ','
2>c:\unreal\4132\engine\source\runtime\engine\public\ComponentInstanceDataCache.h(84): error C2065: 'FTransform': undeclared identifier
2>c:\unreal\4132\engine\source\runtime\engine\public\ComponentInstanceDataCache.h(84): error C2976: 'TMap': too few template arguments
2>  c:\unreal\4132\engine\source\runtime\core\public\Containers/ContainersFwd.h(13): note: see declaration of 'TMap'
2>c:\unreal\4132\engine\source\runtime\engine\public\ComponentInstanceDataCache.h(84): error C2079: 'FComponentInstanceDataCache::InstanceComponentTransformToRootMap' uses undefined class 'TMap'
2>c:\unreal\4132\engine\source\runtime\engine\public\ComponentInstanceDataCache.h(76): error C2228: left of '.Num' must have class/struct/union
2>  c:\unreal\4132\engine\source\runtime\engine\public\ComponentInstanceDataCache.h(76): note: type is 'const int'
2>C:\Unreal\4132\Engine\Source\Runtime\Core\Public\Containers\LockFreeList.h(6): error C2065: 'LogLockFreeList': undeclared identifier
2>C:\Unreal\4132\Engine\Source\Runtime\Core\Public\Containers\LockFreeList.h(6): error C2065: 'Log': undeclared identifier
2>C:\Unreal\4132\Engine\Source\Runtime\Core\Public\Containers\LockFreeList.h(6): error C2065: 'All': undeclared identifier
2>C:\Unreal\4132\Engine\Source\Runtime\Core\Public\Containers\LockFreeList.h(6): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
2>C:\Unreal\4132\Engine\Source\Runtime\Core\Public\Containers\LockFreeList.h(6): error C2491: 'DECLARE_LOG_CATEGORY_EXTERN': definition of dllimport data not allowed
2>C:\Unreal\4132\Engine\Source\Runtime\Core\Public\Containers\LockFreeList.h(6): error C2440: 'initializing': cannot convert from 'initializer list' to 'int'
2>  C:\Unreal\4132\Engine\Source\Runtime\Core\Public\Containers\LockFreeList.h(6): note: The initializer contains too many elements
2>C:\Unreal\4132\Engine\Source\Runtime\Core\Public\Containers\LockFreeList.h(17): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
2>C:\Unreal\4132\Engine\Source\Runtime\Core\Public\Containers\LockFreeList.h(17): error C2146: syntax error: missing ';' before identifier 'FLockFreeListCounter'
2>c:\unreal\4132\engine\source\runtime\core\public\containers\LockFreeVoidPointerListBase.h(22): error C2504: 'FNoncopyable': base class undefined
2>c:\unreal\4132\engine\source\runtime\core\public\containers\LockFreeVoidPointerListBase.h(226): error C3646: 'LockCount': unknown override specifier
2>c:\unreal\4132\engine\source\runtime\core\public\containers\LockFreeVoidPointerListBase.h(226): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
2>c:\unreal\4132\engine\source\runtime\core\public\containers\LockFreeVoidPointerListBase.h(228): error C3646: 'MarkedForDeath': unknown override specifier
2>c:\unreal\4132\engine\source\runtime\core\public\containers\LockFreeVoidPointerListBase.h(228): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
2>c:\unreal\4132\engine\source\runtime\core\public\containers\LockFreeVoidPointerListBase.h(582): error C3646: 'NumUsedLinks': unknown override specifier
2>c:\unreal\4132\engine\source\runtime\core\public\containers\LockFreeVoidPointerListBase.h(582): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
2>c:\unreal\4132\engine\source\runtime\core\public\containers\LockFreeVoidPointerListBase.h(584): error C3646: 'NumFreeLinks': unknown override specifier
2>c:\unreal\4132\engine\source\runtime\core\public\containers\LockFreeVoidPointerListBase.h(584): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
2>c:\unreal\4132\engine\source\runtime\core\public\containers\LockFreeVoidPointerListBase.h(586): error C3646: 'NumAllocatedLinks': unknown override specifier
2>c:\unreal\4132\engine\source\runtime\core\public\containers\LockFreeVoidPointerListBase.h(586): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
2>c:\unreal\4132\engine\source\runtime\core\public\containers\LockFreeVoidPointerListBase.h(46): error C3861: 'checkSlow': identifier not found
2>c:\unreal\4132\engine\source\runtime\core\public\containers\LockFreeVoidPointerListBase.h(98): error C3861: 'checkSlow': identifier not found
2>c:\unreal\4132\engine\source\runtime\core\public\containers\LockFreeVoidPointerListBase.h(115): error C3861: 'checkSlow': identifier not found
2>c:\unreal\4132\engine\source\runtime\core\public\containers\LockFreeVoidPointerListBase.h(197): error C2653: 'FPlatformMisc': is not a class or namespace name
2>c:\unreal\4132\engine\source\runtime\core\public\containers\LockFreeVoidPointerListBase.h(197): error C3861: 'MemoryBarrier': identifier not found
2>c:\unreal\4132\engine\source\runtime\core\public\containers\LockFreeVoidPointerListBase.h(209): error C2653: 'FPlatformMisc': is not a class or namespace name
2>c:\unreal\4132\engine\source\runtime\core\public\containers\LockFreeVoidPointerListBase.h(209): error C3861: 'MemoryBarrier': identifier not found
2>c:\unreal\4132\engine\source\runtime\core\public\containers\LockFreeVoidPointerListBase.h(250): error C2653: 'FPlatformAtomics': is not a class or namespace name
2>c:\unreal\4132\engine\source\runtime\core\public\containers\LockFreeVoidPointerListBase.h(250): error C3861: 'InterlockedCompareExchangePointer': identifier not found
2>c:\unreal\4132\engine\source\runtime\core\public\containers\LockFreeVoidPointerListBase.h(276): error C3861: 'checkSlow': identifier not found
2>c:\unreal\4132\engine\source\runtime\core\public\containers\LockFreeVoidPointerListBase.h(289): error C2653: 'FPlatformAtomics': is not a class or namespace name
2>c:\unreal\4132\engine\source\runtime\core\public\containers\LockFreeVoidPointerListBase.h(289): error C3861: 'InterlockedCompareExchangePointer': identifier not found
2>c:\unreal\4132\engine\source\runtime\core\public\containers\LockFreeVoidPointerListBase.h(323): error C2653: 'FPlatformAtomics': is not a class or namespace name
2>c:\unreal\4132\engine\source\runtime\core\public\containers\LockFreeVoidPointerListBase.h(323): error C3861: 'InterlockedCompareExchangePointer': identifier not found
2>c:\unreal\4132\engine\source\runtime\core\public\containers\LockFreeVoidPointerListBase.h(347): error C2653: 'FPlatformAtomics': is not a class or namespace name
2>c:\unreal\4132\engine\source\runtime\core\public\containers\LockFreeVoidPointerListBase.h(347): error C3861: 'InterlockedCompareExchangePointer': identifier not found
2>c:\unreal\4132\engine\source\runtime\core\public\containers\LockFreeVoidPointerListBase.h(350): error C3861: 'checkSlow': identifier not found
2>c:\unreal\4132\engine\source\runtime\core\public\containers\LockFreeVoidPointerListBase.h(377): error C3861: 'checkSlow': identifier not found
2>c:\unreal\4132\engine\source\runtime\core\public\containers\LockFreeVoidPointerListBase.h(378): error C2653: 'FPlatformAtomics': is not a class or namespace name
2>c:\unreal\4132\engine\source\runtime\core\public\containers\LockFreeVoidPointerListBase.h(378): error C3861: 'InterlockedCompareExchangePointer': identifier not found
2>c:\unreal\4132\engine\source\runtime\core\public\containers\LockFreeVoidPointerListBase.h(412): error C2039: 'LockCount': is not a member of 'FLockFreeVoidPointerListBase::FLink'
2>  c:\unreal\4132\engine\source\runtime\core\public\containers\LockFreeVoidPointerListBase.h(217): note: see declaration of 'FLockFreeVoidPointerListBase::FLink'
2>c:\unreal\4132\engine\source\runtime\core\public\containers\LockFreeVoidPointerListBase.h(412): error C2228: left of '.Increment' must have class/struct/union
2>c:\unreal\4132\engine\source\runtime\core\public\containers\LockFreeVoidPointerListBase.h(413): error C2653: 'FPlatformMisc': is not a class or namespace name
2>c:\unreal\4132\engine\source\runtime\core\public\containers\LockFreeVoidPointerListBase.h(413): error C3861: 'MemoryBarrier': identifier not found
2>c:\unreal\4132\engine\source\runtime\core\public\containers\LockFreeVoidPointerListBase.h(425): error C3861: 'checkSlow': identifier not found
2>c:\unreal\4132\engine\source\runtime\core\public\containers\LockFreeVoidPointerListBase.h(426): error C3861: 'checkSlow': identifier not found
2>c:\unreal\4132\engine\source\runtime\core\public\containers\LockFreeVoidPointerListBase.h(433): error C2653: 'FPlatformMisc': is not a class or namespace name
2>c:\unreal\4132\engine\source\runtime\core\public\containers\LockFreeVoidPointerListBase.h(433): error C3861: 'MemoryBarrier': identifier not found
2>c:\unreal\4132\engine\source\runtime\core\public\containers\LockFreeVoidPointerListBase.h(443): error C2065: 'MarkedForDeath': undeclared identifier
2>c:\unreal\4132\engine\source\runtime\core\public\containers\LockFreeVoidPointerListBase.h(443): error C2228: left of '.GetValue' must have class/struct/union
2>  c:\unreal\4132\engine\source\runtime\core\public\containers\LockFreeVoidPointerListBase.h(443): note: type is 'unknown-type'
2>c:\unreal\4132\engine\source\runtime\core\public\containers\LockFreeVoidPointerListBase.h(443): error C3861: 'checkSlow': identifier not found
2>c:\unreal\4132\engine\source\runtime\core\public\containers\LockFreeVoidPointerListBase.h(470): error C2653: 'FPlatformMisc': is not a class or namespace name
2>c:\unreal\4132\engine\source\runtime\core\public\containers\LockFreeVoidPointerListBase.h(470): error C3861: 'MemoryBarrier': identifier not found
2>c:\unreal\4132\engine\source\runtime\core\public\containers\LockFreeVoidPointerListBase.h(472): error C2065: 'MarkedForDeath': undeclared identifier
2>c:\unreal\4132\engine\source\runtime\core\public\containers\LockFreeVoidPointerListBase.h(472): error C2228: left of '.Increment' must have class/struct/union
2>  c:\unreal\4132\engine\source\runtime\core\public\containers\LockFreeVoidPointerListBase.h(472): note: type is 'unknown-type'
2>c:\unreal\4132\engine\source\runtime\core\public\containers\LockFreeVoidPointerListBase.h(473): error C3861: 'checkSlow': identifier not found
2>c:\unreal\4132\engine\source\runtime\core\public\containers\LockFreeVoidPointerListBase.h(499): error C3861: 'checkSlow': identifier not found
2>c:\unreal\4132\engine\source\runtime\core\public\containers\LockFreeVoidPointerListBase.h(500): error C2065: 'NumUsedLinks': undeclared identifier
2>c:\unreal\4132\engine\source\runtime\core\public\containers\LockFreeVoidPointerListBase.h(500): error C2228: left of '.Increment' must have class/struct/union
2>  c:\unreal\4132\engine\source\runtime\core\public\containers\LockFreeVoidPointerListBase.h(500): note: type is 'unknown-type'
2>c:\unreal\4132\engine\source\runtime\core\public\containers\LockFreeVoidPointerListBase.h(502): error C2065: 'LogLockFreeList': undeclared identifier
2>c:\unreal\4132\engine\source\runtime\core\public\containers\LockFreeVoidPointerListBase.h(502): error C2065: 'Log': undeclared identifier
2>c:\unreal\4132\engine\source\runtime\core\public\containers\LockFreeVoidPointerListBase.h(502): error C3861: 'TEXT': identifier not found
2>c:\unreal\4132\engine\source\runtime\core\public\containers\LockFreeVoidPointerListBase.h(502): error C2065: 'NumUsedLinks': undeclared identifier
2>c:\unreal\4132\engine\source\runtime\core\public\containers\LockFreeVoidPointerListBase.h(502): error C2228: left of '.GetValue' must have class/struct/union
2>  c:\unreal\4132\engine\source\runtime\core\public\containers\LockFreeVoidPointerListBase.h(502): note: type is 'unknown-type'
2>c:\unreal\4132\engine\source\runtime\core\public\containers\LockFreeVoidPointerListBase.h(502): error C3861: 'UE_CLOG': identifier not found
2>c:\unreal\4132\engine\source\runtime\core\public\containers\LockFreeVoidPointerListBase.h(508): error C2065: 'NumFreeLinks': undeclared identifier
2>c:\unreal\4132\engine\source\runtime\core\public\containers\LockFreeVoidPointerListBase.h(508): error C2228: left of '.Decrement' must have class/struct/union
2>  c:\unreal\4132\engine\source\runtime\core\public\containers\LockFreeVoidPointerListBase.h(508): note: type is 'unknown-type'
2>c:\unreal\4132\engine\source\runtime\core\public\containers\LockFreeVoidPointerListBase.h(512): error C2065: 'NumAllocatedLinks': undeclared identifier
2>c:\unreal\4132\engine\source\runtime\core\public\containers\LockFreeVoidPointerListBase.h(512): error C2228: left of '.Increment' must have class/struct/union
2>  c:\unreal\4132\engine\source\runtime\core\public\containers\LockFreeVoidPointerListBase.h(512): note: type is 'unknown-type'
2>c:\unreal\4132\engine\source\runtime\core\public\containers\LockFreeVoidPointerListBase.h(514): error C2065: 'LogLockFreeList': undeclared identifier
2>c:\unreal\4132\engine\source\runtime\core\public\containers\LockFreeVoidPointerListBase.h(514): error C2065: 'Log': undeclared identifier
2>c:\unreal\4132\engine\source\runtime\core\public\containers\LockFreeVoidPointerListBase.h(514): error C3861: 'TEXT': identifier not found
2>c:\unreal\4132\engine\source\runtime\core\public\containers\LockFreeVoidPointerListBase.h(514): error C2065: 'NumAllocatedLinks': undeclared identifier
2>c:\unreal\4132\engine\source\runtime\core\public\containers\LockFreeVoidPointerListBase.h(514): error C2228: left of '.GetValue' must have class/struct/union
2>  c:\unreal\4132\engine\source\runtime\core\public\containers\LockFreeVoidPointerListBase.h(514): note: type is 'unknown-type'
2>c:\unreal\4132\engine\source\runtime\core\public\containers\LockFreeVoidPointerListBase.h(514): error C3861: 'UE_CLOG': identifier not found
2>c:\unreal\4132\engine\source\runtime\core\public\containers\LockFreeVoidPointerListBase.h(518): error C2039: 'LockCount': is not a member of 'FLockFreeVoidPointerListBase::FLink'
2>  c:\unreal\4132\engine\source\runtime\core\public\containers\LockFreeVoidPointerListBase.h(217): note: see declaration of 'FLockFreeVoidPointerListBase::FLink'
2>c:\unreal\4132\engine\source\runtime\core\public\containers\LockFreeVoidPointerListBase.h(518): error C2228: left of '.Increment' must have class/struct/union
2>c:\unreal\4132\engine\source\runtime\core\public\containers\LockFreeVoidPointerListBase.h(520): error C3861: 'checkSlow': identifier not found
2>c:\unreal\4132\engine\source\runtime\core\public\containers\LockFreeVoidPointerListBase.h(521): error C3861: 'checkSlow': identifier not found
2>c:\unreal\4132\engine\source\runtime\core\public\containers\LockFreeVoidPointerListBase.h(522): error C2039: 'LockCount': is not a member of 'FLockFreeVoidPointerListBase::FLink'
2>  c:\unreal\4132\engine\source\runtime\core\public\containers\LockFreeVoidPointerListBase.h(217): note: see declaration of 'FLockFreeVoidPointerListBase::FLink'
2>c:\unreal\4132\engine\source\runtime\core\public\containers\LockFreeVoidPointerListBase.h(522): error C2228: left of '.GetValue' must have class/struct/union
2>c:\unreal\4132\engine\source\runtime\core\public\containers\LockFreeVoidPointerListBase.h(522): error C3861: 'checkSlow': identifier not found
2>c:\unreal\4132\engine\source\runtime\core\public\containers\LockFreeVoidPointerListBase.h(529): error C2653: 'FPlatformMisc': is not a class or namespace name
2>c:\unreal\4132\engine\source\runtime\core\public\containers\LockFreeVoidPointerListBase.h(529): error C3861: 'MemoryBarrier': identifier not found
2>c:\unreal\4132\engine\source\runtime\core\public\containers\LockFreeVoidPointerListBase.h(539): error C3861: 'checkSlow': identifier not found
2>c:\unreal\4132\engine\source\runtime\core\public\containers\LockFreeVoidPointerListBase.h(540): error C2065: 'NumUsedLinks': undeclared identifier
2>c:\unreal\4132\engine\source\runtime\core\public\containers\LockFreeVoidPointerListBase.h(540): error C2228: left of '.Decrement' must have class/struct/union
2>  c:\unreal\4132\engine\source\runtime\core\public\containers\LockFreeVoidPointerListBase.h(540): note: type is 'unknown-type'
2>c:\unreal\4132\engine\source\runtime\core\public\containers\LockFreeVoidPointerListBase.h(541): error C2039: 'LockCount': is not a member of 'FLockFreeVoidPointerListBase::FLink'
2>  c:\unreal\4132\engine\source\runtime\core\public\containers\LockFreeVoidPointerListBase.h(217): note: see declaration of 'FLockFreeVoidPointerListBase::FLink'
2>c:\unreal\4132\engine\source\runtime\core\public\containers\LockFreeVoidPointerListBase.h(541): error C2228: left of '.Increment' must have class/struct/union
2>c:\unreal\4132\engine\source\runtime\core\public\containers\LockFreeVoidPointerListBase.h(542): error C2653: 'FPlatformMisc': is not a class or namespace name
2>c:\unreal\4132\engine\source\runtime\core\public\containers\LockFreeVoidPointerListBase.h(542): error C3861: 'MemoryBarrier': identifier not found
2>c:\unreal\4132\engine\source\runtime\core\public\containers\LockFreeVoidPointerListBase.h(544): error C2065: 'NumFreeLinks': undeclared identifier
2>c:\unreal\4132\engine\source\runtime\core\public\containers\LockFreeVoidPointerListBase.h(544): error C2228: left of '.Increment' must have class/struct/union
2>  c:\unreal\4132\engine\source\runtime\core\public\containers\LockFreeVoidPointerListBase.h(544): note: type is 'unknown-type'
2>c:\unreal\4132\engine\source\runtime\core\public\containers\LockFreeVoidPointerListBase.h(552): error C3861: 'checkSlow': identifier not found
2>c:\unreal\4132\engine\source\runtime\core\public\containers\LockFreeVoidPointerListBase.h(600): error C2653: 'FPlatformMisc': is not a class or namespace name
2>c:\unreal\4132\engine\source\runtime\core\public\containers\LockFreeVoidPointerListBase.h(600): error C3861: 'MemoryBarrier': identifier not found
2>c:\unreal\4132\engine\source\runtime\core\public\containers\LockFreeVoidPointerListBase.h(600): fatal error C1003: error count exceeds 100; stopping compilation
2>ERROR : UBT error : Failed to produce item: C:\Users\David\Documents\Unreal Projects\ProjectName\Binaries\Win64\UE4Editor-ProjectName.dll


After reading some similar errors that people had on the answers site, I thought that the “Game” class that I created could be conflicting with a pre-existing engine class, so I did the following:

  1. I removed Game.h and Game.cpp from the Visual Studio project.
  2. I deleted Game.h and Game.cpp from the Source folder of the project.
  3. I deleted the contents of the Binaries folder of the project.
  4. I deleted the Intermediate folder of the project.
  5. I regenerated the Visual Studio project files from the UPROJECT file.
  6. I cleaned the project from inside Visual Studio.
  7. I rebuilt the entire project.

This, however, did not fix the issue. I still get the same set of errors when trying to compile.

Any ideas as to what else may be causing the issue?

In the meantime, I created a new project, copied my old functioning classes, rebuilt, copied my old content, and fixed all of the custom enum and function references in the blueprints and it is compiling and running just fine. I have put my project under source control so this can’t happen again, but I would still like to know how to fix this for future reference.

Well this happened again to my new project, and I tried restoring from the backup again and it has the same problem too. All I did was add a new class with the name “LBGame” and I am getting the same errors again. What is going on here?

Seems like a “;” is missing at some line in one of your classes…

If you can share your code we may be able to help better.

I’ve attached the contents of my source folder.

hmm… i’ve added your classes to an empty project, but no error is appearing when I compile…

one problem can be, missing #include statements. make sure that new class has it’s own “—.generated.h” included in h file.
another can be, you might have a circular dependency call… make sure that two headers/classes are not calling each other with #include statements.