Superclass must be CoreUObject.Object, not Engine.Actor

Hi, I am trying to follow this Unreal Tutorial Intro to Programming (https://www.youtube.com/watch?v=Q3AvZmZEPyc), but my code has this error which prevent me to build the engine.

Error 1 error : In
TemporaryUHTHeader_Powerup:
/Script/Pizza.TemporaryUHTHeader_Powerup’s
superclass must be
/Script/CoreUObject.Object, not
/Script/Engine.Actor D:\Unreal
Projects\Pizza\Source\Pizza\Public\Powerup.h 12 1 Pizza

I tried redo it. It successfully built when the code is default (header only contains GENERATED_UCLASS_BODY ()). I can see the my class in the Class Viewer in UE Editor. However, VS refuses to build the project when I start adding my own codes. Now, even if I delete my code, it still refuses compiling.

I tried rebuild instead of build, and get this error:

Error 1 error MSB3073: The command
““C:\Program Files (x86)\Epic
Games\4.4\Engine\Build\BatchFiles\Rebuild.bat”
PizzaEditor Win64 DebugGame “D:\Unreal
Projects\Pizza\Pizza.uproject”
-rocket” exited with code 255. C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.MakeFile.Targets 43 5 Pizza

Well, I am completely new to UE4, so please help :frowning:

Hey,

It may be the space between UCLASS and (), so try removing that. UnrealHeaderTool seems to think that the file doesn’t contain a UClass, so it’s attempting to generate one, and failing. Also remove the spaces after UPROPERTY and GENERATED_CLASS_BODY, and the semi-colon at the end of GENERATED_CLASS_BODY().

UHT can be quite sensitive to syntax sometimes. Let me know if that helps, and if not, I’ll look into it further. If it is the cause of the problem then we can try to make UHT a bit more resilient in that case.

Steve

This error only happens when you have 2 Classes with the same name and they extend two different classes so lets say you have the following:

ACar : public AActor
UCar : public UObject

(Note! the prefix is not part of the class name i think its mostly used by the headertool.)

The error printed int the engine is weird due to the parsing order and looks like this is the first error the header tool detects. Once you have fixed the class name the error should dissapear.