Why am i getting so many errors ? -_-

So im trying to add Some things to the HUD of this project and UE4 is crying like there is no tomorrow. As far as i can tell everything(all my code) is fine. This is making me want to throw my pc out the window,douse it in gasoline, and torch it. Please help i do not know what is wrong D: .

I have already declared it as a pointer and it is telling me its not -_-
VS ERRORS:

CODE :
RPG.h



// Copyright 1998-2016 Epic Games, Inc. All Rights Reserved.

#ifndef __RPG_H__
#define __RPG_H__

#include "Engine.h"

DECLARE_LOG_CATEGORY_EXTERN(LogRPG, Log, All);


#endif



RPG.cpp



// Copyright 1998-2016 Epic Games, Inc. All Rights Reserved.

#include "RPG.h"


IMPLEMENT_PRIMARY_GAME_MODULE( FDefaultGameModuleImpl, RPG, "RPG" );

DEFINE_LOG_CATEGORY(LogRPG)
 


RPGGamemode.h



// Copyright 1998-2016 Epic Games, Inc. All Rights Reserved.
#pragma once
#include "GameFramework/GameMode.h"
#include "RPGGameMode.generated.h"

UCLASS(minimalapi)
class ARPGGameMode : public AGameMode
{
	GENERATED_BODY()

		virtual void BeginPlay() override;

public:
	ARPGGameMode();

	enum EHUDState : uint8 {HS_Ingame, HS_Inventory, HS_Shop};

	//Checks the hud state, then calls apply  hud
	void ApplyHUDChanges();

	//Getter for hud state
	uint8 GetHUDState();

	//setter for the hud state, applies the new state then calls ApplyHudChanges()
	UFUNCTION(BlueprintCallable, Category = "HUD Functions")
	void SetHUDState(uint8 NewState);

	//Applys a hud to the screen, returns true if succsesful, false otherwise.
	bool ApplyHUD(TSubclassOf <class UUserWidget> WidgetToApply, bool bShowMouseCursor, bool EnableClickEvents);

protected:
	uint8 HUDState;
	
	//The hud to be shown in-game
	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "HUD Widgets", Meta = (BlueprintProtected = true))
		TSubclassOf<class UUserWidget> IngameHUDClass; //TSubclasOf makes it so you can only edit SUB CLASSES OF THE BASE CLASS!!!

	//The hud to be shown in the inventory
	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "HUD Widgets", Meta = (BlueprintProtected = true))
		TSubclassOf<class UUserWidget> InventoryHUDClass;

	//The hud to be shown in the shop
	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "HUD Widgets", Meta = (BlueprintProtected = true))
		TSubclassOf<class UUserWidget> ShopHUDClass;

	UPROPERTY()
		UUserWidget* CurrentWidget;
};


RPGGamemode.cpp



// Copyright 1998-2016 Epic Games, Inc. All Rights Reserved.

#include "RPG.h"
#include "RPGGameMode.h"
#include "RPGPlayerController.h"
#include "RPGCharacter.h"
#include "Blueprint/UserWidget.h"

void ARPGGameMode::BeginPlay()
{
	//As soon as the player loads into the game apply the hud
	ApplyHUDChanges();
}

ARPGGameMode::ARPGGameMode()
{
	// use our custom PlayerController class
	PlayerControllerClass = ARPGPlayerController::StaticClass();

	// set default pawn class to our Blueprinted character
	static ConstructorHelpers::FClassFinder<APawn> PlayerPawnBPClass(TEXT("/Game/TopDownCPP/Blueprints/TopDownCharacter"));
	if (PlayerPawnBPClass.Class != NULL)
	{
		DefaultPawnClass = PlayerPawnBPClass.Class;
	}

	//Set the hud state to InGame on defualt
	HUDState = EHUDState::HS_Ingame;
}

void ARPGGameMode::ApplyHUDChanges()
{

	//Remove previous hud to add a new one.
	if (CurrentWidget != nullptr)
	{
		CurrentWidget->RemoveFromParent; // removes the current hud
	}

		switch (HUDState)
		{
		case EHUDState::HS_Ingame: 
			{
				ApplyHUD(IngameHUDClass, false, false);
				break;
			}
		case EHUDState::HS_Inventory:
			{
				ApplyHUD(InventoryHUDClass, true, true);  //ApplyHUD Takes params (HUDCLASS, ShowMouseCursor, EnableClickEvents)
				break;
			}
		case EHUDState::HS_Shop:
			{
				ApplyHUD(ShopHUDClass, true, true);
				break;
			}
		}
}

uint8 ARPGGameMode::GetHUDState()
{
	return HUDState;
}

void ARPGGameMode::SetHUDState(uint8 NewState)
{
	HUDState = NewState;
	ApplyHUDChanges();
}

bool ARPGGameMode::ApplyHUD(TSubclassOf<class UUserWidget> WidgetToApply, bool bShowMouseCursor, bool EnableClickEvents)
{
	//Get a refrence to the player, and the controller
	ARPGCharacter* Character = Cast<ARPGCharacter>(UGameplayStatics::GetPlayerCharacter(this, 0));
	APlayerController* Controller = GetWorld()->GetFirstPlayerController;

	//Null check things to prevent a crash
	if (WidgetToApply != nullptr)
	{
		//Set mouse visablity and click events according to params
		Controller->bShowMouseCursor = bShowMouseCursor;
		Controller->bEnableClickEvents = EnableClickEvents;

		//Create new widget

		CurrentWidget = CreateWidget<UUserWidget>(GetWorld(), WidgetToApply);

		if (CurrentWidget != nullptr)
		{
			CurrentWidget->AddToViewport;
			return true;
		}
		else return false; // if the widget failed to be made then return false
	}
	else return false; // if the widget is null then return false
}


Thanks for the help i am wanting to shoot myself ):.

AddToViewport, RemoveFromParent, and GetFirstPlayerController are functions. You forgot the parenthesis when calling these functions on lines 37, 75, and 90

you sir are a legend thank you so much

No problem bud :slight_smile: