[Project Issue] USpecifier Limit?

I know two things for sure:

  • It is not reproducible in a new project
  • It has to do with creating a new makefile for project, as simply building rather than rebuilding does not cause the issue.

This all began after I created UI classes. I have two AHud classes and two UUserWidget classes. The initial classes compile and work.

Here’s where it gets odd. It appears I’ve run into a limit on USpecifiers. From the last successful compilation I had, I can only add 1 new USpecifier, be it UCLASS(), UFUNCTION(), or UPROPERTY(), after that any additional USpecifiers + a rebuild will result in a compilation error where it states all my forward declarations "use of undefined type ‘ACharacter’ ", be it engine or custom class. As I fix one another pops up.

The only other error I see is a persistent circular dependency error for DataContainers.h, which the project will compile with and has been present since near the beginning. DataContainers.h only includes Globals.h and Data.h. Globals.h includes Data.h. Data.h does not inherit any custom classes.

At this point, I’m stuck and can’t move my project forward until I solve why this issue is occuring.

Here is a normal compilation of actions:

 1>Building 6 actions with 6 processes...  
1> [1/6] SharedPCH.Engine.ShadowErrors.cpp 
1> [2/6] Module.Test.gen.cpp 
1> [3/6] Module.Test.cpp 
1> [4/6] UE4Editor-Test.lib 
1>  Creating library E:\Anvil-Root\Test\Intermediate\Build\Win64\UE4Editor\Development\Test\UE4Editor-Test.lib and object E:\Anvil-Root\Test\Intermediate\Build\Win64\UE4Editor\Development\Test\UE4Editor-Test.exp 
1> [5/6] UE4Editor-Test.dll 
1>  Creating library E:\Anvil-Root\Test\Intermediate\Build\Win64\UE4Editor\Development\Test\UE4Editor-Test.suppressed.lib and object E:\Anvil-Root\Test\Intermediate\Build\Win64\UE4Editor\Development\Test\UE4Editor-Test.suppressed.exp 
1> [6/6] TestEditor.target 
1>Total time in Parallel executor: 34.37 seconds 

Here is the error compilation of actions:

1>Building 7 actions with 6 processes... 
1> [1/7] SharedPCH.Engine.ShadowErrors.cpp
1> [2/7] Module.Test.gen.2_of_2.cpp 
1> [3/7] Module.Test.gen.1_of_2.cpp 
1> [4/7] Module.Test.cpp 
1>Done building project "Test.vcxproj" -- FAILED. 

I removed the errors because there’s a wall of them all centering around forward declarations.

Here is a nearly identical issue that seems unresolved

I attempted to build without unitybuild, but the result was the same.

1 Like

For reference, so far I have taken these steps to narrow down issue:

  • Removed UMG classes + all references to UMG classes
    ** It did fix compilation, so I added like 30 UPROPERTY()s to a class, which resulted in previous error

  • Stripped all property specifiers from all UPROPERTY()s, UFUNCTION()s, UCLASS()s and USTRUCT()s, which did not fix compilation, same error

  • Fix the circular dependency in DataContainers.h by changing any class references to base UObject references, so that no custom class was referenced via forward declaration. Which did not resolve the circular dependency

  • in a test project I created a few classes, then added the same number of UPROPERTY()s, UFUNCTION()s, UCLASS()s and USTRUCT()s, but it did not result in any error. The project was empty of any logic, which may have made a difference, as the error is centered around class references (to include engine classes like ACharacter pointers).

I cleared the DataContainers.h circular dependency issue. First tried stripping every class within to just Generated_Body(), didn’t work. Split each individual class into a separate header and generated file which worked.

Didn’t solve the issue with one too many USpecifiers though.