I’ve been trying to implement a simple interface into my project Damageable. It contains a single virtual method Damage(float damage). Everything appears to be fine with intellisense, however when the project is compiled in the editor it throws the following error
Error D:\GamesCreate\Reflections\Reflections\Binaries\Win64\UE4Editor-Reflections-1327.dll : fatal error LNK1120: 1 unresolved externals
Error ReflectionsCharacter.cpp.obj : error LNK2001: unresolved external symbol “public: virtual void __cdecl AReflectionsCharacter::Damage(float)” (?Damage@AReflectionsCharacter@@UEAAXM@Z)
Error Reflections.generated.cpp.obj : error LNK2001: unresolved external symbol “public: virtual void __cdecl AReflectionsCharacter::Damage(float)” (?Damage@AReflectionsCharacter@@UEAAXM@Z)
my code for my interface is as follows
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "DamageableInterface.generated.h"
// This class does not need to be modified.
UINTERFACE(MinimalAPI)
class UDamageableInterface : public UInterface
{
GENERATED_BODY()
};
/**
*
*/
class REFLECTIONS_API IDamageableInterface
{
GENERATED_BODY()
// Add interface functions to this class. This is the class that will be inherited to implement this interface.
public:
virtual void Damage(float damage) = 0;
};
It seems like such a simple task to create a pure virtual function within an interface, but I cannot figure out how to implement it. I think it has something to do with the function being virtual, however I don’t know where to go from here. Why is this error being thrown and what can I do to fix it?