I am following GameDev.tv's unreal C++ course, but I am getting an error that is causing my compiler to fail. I'm coding a player controller, and I think I followed all the steps right but when I call the GameHasEnded() function from Super in the playercontroller.cpp, It gets an error saying: anything followed by '::' must be followed by a class or namespace.
Here is my .h file which has no known compiler errors.
#pragma once
#include "CoreMinimal.h"
#include "GameFramework/PlayerController.h"
#include "ShooterPlayerController.generated.h"
/**
*
*/
UCLASS()
class SIMPLESHOOTER_API AShooterPlayerController : public APlayerController
{
GENERATED_BODY()
public:
virtual void GameHasEnded(class AActor *EndGameFocus = nullptr, bool bIsWinner = false) override;
};
Here is my .cpp file with the problem.
// Fill out your copyright notice in the Description page of Project Settings.
#include "ShooterPlayerController.h"
void GameHasEnded(class AActor *EndGameFocus, bool bIsWinner)
{
//this is the problem super
Super::GameHasEnded(EndGameFocus, bIsWinner);
}
I have a lot of other scripts, but I don't think they're related to the problem. I'm using Unreal 4.26, and Visual Studio 2019. I have no idea why this is getting an error, the code is exactly the same as the instructor’s code.