Linker error when trying to use ULyraInputComponent from a Plugin

Hi,

I’m creating a new plugin to have the bases for a top-down action RPG Lyra’s experience.
I would like to create a new component that inherits from ULyraHeroComponent and overrides InitializePlayerInput to make the move input to ignore the control rotation.

TopDownHeroComponent.h

UCLASS()
class TOPDOWNACTION_API UTopDownHeroComponent : public ULyraHeroComponent
{
	GENERATED_BODY()
	
protected:

	virtual void InitializePlayerInput(UInputComponent* PlayerInputComponent) override;

	virtual void Input_MoveViewPointBased(const FInputActionValue& InputActionValue);
};

TopDownHeroComponent.cpp

#include "Character/TopDownHeroComponent.h"
#include "Player/LyraLocalPlayer.h"
#include "EnhancedInputSubsystems.h"
#include "Character/LyraPawnExtensionComponent.h"
#include "Character/LyraPawnData.h"
#include "Input/LyraInputConfig.h"
#include "Input/LyraInputComponent.h"
#include "LyraGameplayTags.h"
#include "Components/GameFrameworkComponentManager.h"
#include "UserSettings/EnhancedInputUserSettings.h"
#include "InputMappingContext.h"

void UTopDownHeroComponent::InitializePlayerInput(UInputComponent* PlayerInputComponent)
{
	check(PlayerInputComponent);

	ULyraInputComponent* LyraIC = Cast<ULyraInputComponent>(PlayerInputComponent);
}

void UTopDownHeroComponent::Input_MoveViewPointBased(const FInputActionValue& InputActionValue)
{
    // ...
}

This is causing the following linker error:"

error LNK2019: unresolved external symbol "private: static class UClass * __cdecl ULyraInputComponent::GetPrivateStaticClass(void)" (?GetPrivateStaticClass@ULyraInputComponent@@CAPEAVUClass@@XZ) referenced in function "protected: virtual void __cdecl UTopDownHeroComponent::InitializePlayerInput(class UInputComponent *)" (?InitializePlayerInput@UTopDownHeroComponent@@MEAAXPEAVUInputComponent@@@Z)

I noticed that ULyraInputComponent doesn’t have the LYRAGAME_API macro before the class name as usual.

Is there a way to get this problem gone without changing LyraInputComponent.h file?

Thanks in advance.

1 Like