UGameplayStatics::GetAllActorsOfClass is inaccessable?

I have been trying to implement multiple different uses of UGameplayStatics but I consistently am met with the error of “UGameplayStatics::GetAllActorsOfClass is inaccessible”. Based on documentation and everyone else, this clearly should not be the case.

I have been trying to use multiple different #include for referencing UGameplayStatics but none of them seem to make a change.

Sample Code:

#include "MyAIController.h"
#include "Kismet/GameplayStatics.h"

void AMyAIController::Possess(APawn* Pawn)
{
	Super::Possess(Pawn);

		TArray<AActor*> FoundActors;

		UGameplayStatics::GetAllActorsOfClass(GetWorld(), AAITargetPoint::StaticClass(), FoundActors);

}

Am i referencing UGameplayStatics incorrectly or is there a bigger issue i should be looking for?

I had the same problem. This approach worked for me better:

A new, community-hosted Unreal Engine Wiki - Announcements - Unreal Engine ForumsObject%26_Actor_Iterators,_Optional_Class_Scope_For_Faster_Search

#include "EngineUtils.h"
#include "Engine/StaticMeshActor.h"

for (TActorIterator<AStaticMeshActor> ActorItr(GetWorld()); ActorItr; ++ActorItr) 
   { 
    	AStaticMeshActor *Mesh = *ActorItr; 
    	UE_LOG(LogTemp, Warning, TEXT("Found Actor: %s"),*Mesh->GetName());
    }