Help - "pointer to incomplete class type not allowed"

I keep getting an error “pointer to incomplete class type is not allowed” on the GetWorld() method. I saw other forum posts, saying it’s a bug in how Unreal talks to VisStudio Intellisense, but saying that it should still compile. I’m getting failed builds. I’ve noticed that the order in which the headers are listed seems critically important, because if I include Engine/World.h on the wrong line, then Intellisense suddenly fails to recognize other Unreal classes.

At first my builds were complaining cannot convert type APawn to AActor. So I changed the line to:
APawn ActorThatOpens = GetWorld()->GetFirstPlayerController()->GetPawn();
now it complains that it can’t convert from APawn to APawn. I’m guessing one of those is an incomplete class object, so it barfs?

In my .h, I’ve got:
#include “CoreMinimal.h”
#include “Engine/TriggerVolume.h”
#include “Components/ActorComponent.h”
#include “OpenDoor.generated.h”

and in my .cpp I’ve got:
#include “OpenDoor.h”
#include “GameFramework/Actor.h”
#include “Engine/World.h”

If I list the Engine/World.h in the wrong place, suddenly my UCLASSes go wrong, so I’ve discovered that the order of these includes is very important, so I’m guessing I’ve got these out of order, or I have something in my .cpp which should be in my .h file. Can anyone advise?
thanks

Nevermind… this is embarrassing. When I changed it to APawn instead of AActor, I left out the * Adding that back in, and even though Intellisense doesn’t like it, it still builds just fine.

Also try adding this, For anyone else with this issue.

#include “Engine/World.h”

4 Likes

Privacy & Terms