I’m getting the error and its frustrating me because I have no idea whats wrong, if anyone could help I would really thnakful.
- UW_MainMenu.cpp.obj : error LNK2001: unresolved external symbol “protected: virtual void __cdecl UUW_MainMenu::RemoveFromParent(void)” (?RemoveFromParent@UUW_MainMenu@@MEAAXXZ)
- UW_MainMenu.gen.cpp.obj : error LNK2001: unresolved external symbol “protected: virtual void __cdecl UUW_MainMenu::RemoveFromParent(void)” (?RemoveFromParent@UUW_MainMenu@@MEAAXXZ)
- C:\Users\Adamojlo119\Documents\Unreal Projects\Voxel_Dungeon\Binaries\Win64\UE4Editor-Voxel_Dungeon-7558.dll : fatal error LNK1120: number of unrecognized external elements: 1
My .CPP File:
#include "UW_MainMenu.h"
#include "Button.h"
bool UUW_MainMenu::Initialize()
{
if (!Super::Initialize())return false;
if (!ensure(Button_NewGame != nullptr))return false;
Button_NewGame->OnClicked.AddDynamic(this, &UUW_MainMenu::NewGame);
if (!ensure(Button_ContinueGame != nullptr))return false;
Button_ContinueGame->OnClicked.AddDynamic(this, &UUW_MainMenu::ContinueGame);
if (!ensure(Button_Settings != nullptr))return false;
Button_Settings->OnClicked.AddDynamic(this, &UUW_MainMenu::Settings);
if (!ensure(Button_Credits != nullptr))return false;
Button_Credits->OnClicked.AddDynamic(this, &UUW_MainMenu::Credits);
if (!ensure(Button_QuitGame != nullptr))return false;
Button_QuitGame->OnClicked.AddDynamic(this, &UUW_MainMenu::QuitGame);
PC->SetInputMode(FInputModeUIOnly());
return true;
}
void UUW_MainMenu::NewGame()
{
GEngine->AddOnScreenDebugMessage(-1, 15.0f, FColor::Red, "NewGame");
RemoveFromParent();
PC->SetInputMode(FInputModeGameOnly());
}
void UUW_MainMenu::ContinueGame()
{
GEngine->AddOnScreenDebugMessage(-1, 15.0f, FColor::Red, "ContinueGame");
}
void UUW_MainMenu::Settings()
{
GEngine->AddOnScreenDebugMessage(-1, 15.0f, FColor::Red, "Settings");
}
void UUW_MainMenu::Credits()
{
GEngine->AddOnScreenDebugMessage(-1, 15.0f, FColor::Red, "Credits");
}
void UUW_MainMenu::QuitGame()
{
#if WITH_EDITOR
GEngine->AddOnScreenDebugMessage(-1, 15.0f, FColor::Red, "QuitGame");
return;
#endif
FGenericPlatformMisc::RequestExit(false);
}
My .H File:
#pragma once
#include "CoreMinimal.h"
#include "Blueprint/UserWidget.h"
#include "Kismet/GameplayStatics.h"
#include "UW_MainMenu.generated.h"
UCLASS()
class VOXEL_DUNGEON_API UUW_MainMenu : public UUserWidget
{
GENERATED_BODY()
public:
virtual bool Initialize();
class APlayerController* PC = UGameplayStatics::GetPlayerController(this, 0);
protected:
UPROPERTY(Meta = (BindWidget))
class UButton* Button_NewGame;
UPROPERTY(Meta = (BindWidget))
class UButton* Button_ContinueGame;
UPROPERTY(Meta = (BindWidget))
class UButton* Button_Settings;
UPROPERTY(Meta = (BindWidget))
class UButton* Button_Credits;
UPROPERTY(Meta = (BindWidget))
class UButton* Button_QuitGame;
protected:
UFUNCTION()
void NewGame();
UFUNCTION()
void ContinueGame();
UFUNCTION()
void Settings();
UFUNCTION()
void Credits();
UFUNCTION()
void QuitGame();
protected:
virtual void RemoveFromParent() override;
};