Game feature extending LyraCharacter

In a project based on Lyra , I’m trying to extends the LyraCharacter in a class inside a GameFeature plugin but when I build I get this error:


LNK2019: unresolved external symbol "__declspec(dllimport) public: virtual __cdecl AModularCharacter::~AModularCharacter(void)" (__imp_??1AModularCharacter@@UEAA@XZ) referenced in function "public: virtual __cdecl ALyraCharacter::~ALyraCharacter(void)" (??1ALyraCharacter@@UEAA@XZ)

The class is pretty straigforward:

TopDownCharacter.h
UCLASS(Blueprintable)
class ATopDownCharacter : public ALyraCharacter
{
	GENERATED_BODY()
public:
	ATopDownCharacter(const FObjectInitializer& ObjectInitializer);

	UPROPERTY(VisibleAnywhere)
	USpringArmComponent* CharSpringArmComponent;
	
	
};

TopDownCharacter.cpp:
ATopDownCharacter::ATopDownCharacter(const FObjectInitializer& ObjectInitializer)
	: Super(ObjectInitializer.DoNotCreateDefaultSubobject(TEXT("CameraComponent")))
{
	CharSpringArmComponent = CreateDefaultSubobject<USpringArmComponent>(TEXT("CharSpringArmComponent"));
	CharSpringArmComponent->CreateDefaultSubobject<ULyraCameraComponent>(TEXT("CameraComponent"));
}

Any Idea on what I missed?

It seems that Lyra C++ classes are lacking the LYRAGAME_API tag and that causes issues with some classes when trying to inheriting from them in C++.

Just add the tag to ALyraCharacter.h. It should look like:

UCLASS(...)
class LYRAGAME_API ALyraCharacter : public AModularCharacter, ...
{
	GENERATED_BODY()
...
}
3 Likes