Dear everyone,
I found this weird bug, and I wanted to check with you if it is really a bug before submitting a ticket.
Steps to reproduce it
I have been using UE4.24.3 and VS2019.
- Create a new empty C++ project.
- Add in the *PrivateDependencyModuleNames *the following (it is already there, you need to uncomment it):
PrivateDependencyModuleNames.AddRange(new string] { "Slate", "SlateCore" });
- Create a new C++ class, e.g. an actor named MyActor.
- Create a new function that contains an *FText Property *and it is a UFUNCTION, like the following:
UFUNCTION(BlueprintCallable)
void MyFunction(FText MyParameter);
- The definition in the .cpp can be empty:
void AMyActor::MyFunction(FText MyParameter)
{
}
- Package or Launch the project on an Android Device.
This is the error that I got (the project is called TestAndroid2):
[2/5] MyActor.cpp [armv7-es2]
LogPlayLevel: In file included from D:/Unreal Projects/TestingProjects/TestAndroid2/Source/TestAndroid2/MyActor.cpp:4:
LogPlayLevel: Error: D:/Unreal Projects/TestingProjects/TestAndroid2/Source/TestAndroid2/MyActor.h(13,2): error: incomplete type 'UTextProperty' named in nested name specifier
LogPlayLevel: GENERATED_BODY()
LogPlayLevel: ^~~~~~~~~~~~~~~~
LogPlayLevel: C:/Program Files/Epic Games/UE_4.24/Engine/Source/Runtime/CoreUObject/Public\UObject/ObjectMacros.h(593,29): note: expanded from macro 'GENERATED_BODY'
LogPlayLevel: #define GENERATED_BODY(...) BODY_MACRO_COMBINE(CURRENT_FILE_ID,_,__LINE__,_GENERATED_BODY);
LogPlayLevel: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
LogPlayLevel: C:/Program Files/Epic Games/UE_4.24/Engine/Source/Runtime/CoreUObject/Public\UObject/ObjectMacros.h(588,37): note: expanded from macro 'BODY_MACRO_COMBINE'
LogPlayLevel: #define BODY_MACRO_COMBINE(A,B,C,D) BODY_MACRO_COMBINE_INNER(A,B,C,D)
LogPlayLevel: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
LogPlayLevel: C:/Program Files/Epic Games/UE_4.24/Engine/Source/Runtime/CoreUObject/Public\UObject/ObjectMacros.h(587,43): note: expanded from macro 'BODY_MACRO_COMBINE_INNER'
LogPlayLevel: #define BODY_MACRO_COMBINE_INNER(A,B,C,D) A##B##C##D
LogPlayLevel: ^~~~~~~~~~
LogPlayLevel: note: (skipping 1 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
LogPlayLevel: D:/Unreal Projects/TestingProjects/TestAndroid2/Intermediate/Build/Android/UE4/Inc/TestAndroid2\MyActor.generated.h(102,2): note: expanded from macro 'TestAndroid2_Source_TestAndroid2_MyActor_h_13_GENERATED_BODY'
LogPlayLevel: TestAndroid2_Source_TestAndroid2_MyActor_h_13_RPC_WRAPPERS_NO_PURE_DECLS \
LogPlayLevel: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
LogPlayLevel: D:/Unreal Projects/TestingProjects/TestAndroid2/Intermediate/Build/Android/UE4/Inc/TestAndroid2\MyActor.generated.h(33,18): note: expanded from macro 'TestAndroid2_Source_TestAndroid2_MyActor_h_13_RPC_WRAPPERS_NO_PURE_DECLS'
LogPlayLevel: P_GET_PROPERTY(UTextProperty,Z_Param_MyParameter); \
LogPlayLevel: ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
LogPlayLevel: C:/Program Files/Epic Games/UE_4.24/Engine/Source/Runtime/CoreUObject/Public\UObject/ScriptMacros.h(44,2): note: expanded from macro 'P_GET_PROPERTY'
LogPlayLevel: PropertyType::TCppType ParamName = PropertyType::GetDefaultPropertyValue(); \
LogPlayLevel: ^~~~~~~~~~~~~~
LogPlayLevel: C:/Program Files/Epic Games/UE_4.24/Engine/Source/Runtime/Core/Public\UObject/UObjectHierarchyFwd.h(33,10): note: forward declaration of 'UTextProperty'
LogPlayLevel: class UTextProperty;
LogPlayLevel: ^
LogPlayLevel: In file included from D:/Unreal Projects/TestingProjects/TestAndroid2/Source/TestAndroid2/MyActor.cpp:4:
LogPlayLevel: Error: D:/Unreal Projects/TestingProjects/TestAndroid2/Source/TestAndroid2/MyActor.h(13,2): error: incomplete type 'UTextProperty' named in nested name specifier
LogPlayLevel: GENERATED_BODY()
LogPlayLevel: ^~~~~~~~~~~~~~~~
LogPlayLevel: C:/Program Files/Epic Games/UE_4.24/Engine/Source/Runtime/CoreUObject/Public\UObject/ObjectMacros.h(593,29): note: expanded from macro 'GENERATED_BODY'
LogPlayLevel: #define GENERATED_BODY(...) BODY_MACRO_COMBINE(CURRENT_FILE_ID,_,__LINE__,_GENERATED_BODY);
LogPlayLevel: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
LogPlayLevel: C:/Program Files/Epic Games/UE_4.24/Engine/Source/Runtime/CoreUObject/Public\UObject/ObjectMacros.h(588,37): note: expanded from macro 'BODY_MACRO_COMBINE'
LogPlayLevel: #define BODY_MACRO_COMBINE(A,B,C,D) BODY_MACRO_COMBINE_INNER(A,B,C,D)
LogPlayLevel: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
LogPlayLevel: C:/Program Files/Epic Games/UE_4.24/Engine/Source/Runtime/CoreUObject/Public\UObject/ObjectMacros.h(587,43): note: expanded from macro 'BODY_MACRO_COMBINE_INNER'
LogPlayLevel: #define BODY_MACRO_COMBINE_INNER(A,B,C,D) A##B##C##D
LogPlayLevel: ^~~~~~~~~~
LogPlayLevel: note: (skipping 1 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
LogPlayLevel: D:/Unreal Projects/TestingProjects/TestAndroid2/Intermediate/Build/Android/UE4/Inc/TestAndroid2\MyActor.generated.h(102,2): note: expanded from macro 'TestAndroid2_Source_TestAndroid2_MyActor_h_13_GENERATED_BODY'
LogPlayLevel: TestAndroid2_Source_TestAndroid2_MyActor_h_13_RPC_WRAPPERS_NO_PURE_DECLS \
LogPlayLevel: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
LogPlayLevel: D:/Unreal Projects/TestingProjects/TestAndroid2/Intermediate/Build/Android/UE4/Inc/TestAndroid2\MyActor.generated.h(33,18): note: expanded from macro 'TestAndroid2_Source_TestAndroid2_MyActor_h_13_RPC_WRAPPERS_NO_PURE_DECLS'
LogPlayLevel: P_GET_PROPERTY(UTextProperty,Z_Param_MyParameter); \
LogPlayLevel: ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
LogPlayLevel: C:/Program Files/Epic Games/UE_4.24/Engine/Source/Runtime/CoreUObject/Public\UObject/ScriptMacros.h(44,37): note: expanded from macro 'P_GET_PROPERTY'
LogPlayLevel: PropertyType::TCppType ParamName = PropertyType::GetDefaultPropertyValue(); \
LogPlayLevel: ^~~~~~~~~~~~~~
LogPlayLevel: C:/Program Files/Epic Games/UE_4.24/Engine/Source/Runtime/Core/Public\UObject/UObjectHierarchyFwd.h(33,10): note: forward declaration of 'UTextProperty'
LogPlayLevel: class UTextProperty;
LogPlayLevel: ^
LogPlayLevel: 2 errors generated.
LogPlayLevel: [3/5] MyActor.gen.cpp [armv7-es2]
LogPlayLevel: Took 9.7787936s to run UnrealBuildTool.exe, ExitCode=5
Workaround
However, I have found a way to make it compile and work, but I feel it is more a workaround, rather than the proper way to go.
If you include at the beginning of your MyActor.h the following include:
#include "UObject/TextProperty.h"
Then, everything compiles without any problems.
Of course, if you remove the *PrivateDependency *to *Slate *and SlateCore, everything compiles.
Is this a bug?
Can someone try if this produces a compiling error? Is there a way to proceed, or is it a bug and should I submit a ticket?