How to use MoveToLocation from a character

I currently have this following code in order to move my character to a location.

void ABaseUnit::MoveTo(FVector Target)
{
  
  if(!IsDead)
  {
    AAIController* ai = Cast<AAIController>(GetController());
    ai->moveToLocation(Target,50.0f);
  }
  
}

This will not compile and gives the error message:

Info ERROR: UBT ERROR: Failed to produce item: /home/josh/Documents/Unreal Projects/simplegeometryrts/Binaries/Linux/libUE4Editor-MyProject-951.so

moveToLocation should be spelled MoveToLocation.