如何修复错误标识符 "PlayerViewPointLocation" 未定义

How to fix error identifier "PlayerViewPointLocation" is undefined

我正在学习教程https://www.udemy.com/unrealcourse/learn/lecture/4690340?start=150#overview 它是在 Visual Studio 2015 年之前制作的,所以我想我缺少一个包含文件,但我不确定是哪个或者我是否缺少其他东西。 这是错误所在的函数:

#include "Grabber.h"
#include "Gameframework/Actor.h"
#include "DrawDebugHelpers.h"


#define OUT


// Called every frame
void UGrabber::TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction)
{
    Super::TickComponent(DeltaTime, TickType, ThisTickFunction);

    // get player view point this tick
    FVector PlayerViewpointLocation;
    FRotator PlayerViewPointRotation;
    GetWorld()->GetFirstPlayerController()->GetPlayerViewPoint(
        OUT PlayerViewpointLocation,
        OUT PlayerViewPointRotation
    );

    //logout to test
    /*UE_LOG(LogTemp, Warning, TEXT("Location: %s, Rotation: %s!"), *PlayerViewpointLocation.ToString(), *PlayerViewPointRotation.ToString());*/

    FVector LineTraceEnd = PlayerViewPointLocation /* the error is right here*/ + FVector(0.f, 0.f, 20.f);

    // draw a red trace in the world to visual
    DrawDebugLine(
        GetWorld(),
        PlayerViewpointLocation,
        LineTraceEnd,
        FColor(255, 0, 0),
        false,
        0.f,
        0.f,
        10.f
        );

    // ray cast out to reach distance

    //see what we hit
}

将声明中的 p 大写

// get player view point this tick
FVector PlayerViewpointLocation;
FRotator PlayerViewPointRotation;
GetWorld()->GetFirstPlayerController()->GetPlayerViewPoint(
    OUT PlayerViewpointLocation,
    OUT PlayerViewPointRotation
);