I’m pretty new to C++ programming in UE4 and I got the following problem:
I have created the ActorComponent “PositionOwner” and I would like to read out the object’s owner by:
This is sort of a tricky one to figure out because it’s not so obvious what the problem is. Anytime you are calling a function that returns a type, such as GetOwner( ) returning AActor, you should make sure that you have included the header file that corresponds with that type. This is especially true when you get the 'Pointer to incomplete class" error, as that means the compiler doesn’t know what the type is for the pointer being used: “GetOwner()->”
The problem is that GetOwner( ) returns a Actor type but the UPositionOwner cpp file doesn’t know what that type is, so you have to include the Actor.h file.
If you search “UActorComponent” on the documentation site, it leads you to:
[UActorComponent][1]
At that page, you can then search for the function: GetOwner( )