Hi. I have added a simple interface to the ShooterGame sample (InterfacePickupable.h):
#pragma once
#include "InterfacePickupable.generated.h"
UINTERFACE()
class UInterfacePickupable : public UInterface
{
GENERATED_UINTERFACE_BODY()
};
class IInterfacePickupable
{
GENERATED_IINTERFACE_BODY()
};
And made AShooterPickup inherit from this new interface:
// Base class for pickup objects that can be placed in the world
UCLASS(abstract)
class AShooterPickup : public AActor, public IInterfacePickupable
{
GENERATED_UCLASS_BODY()
And now I’m getting a linker error regarding the constructor of the UInterfacePickupable class:
[1/4] Compile ShooterGame.generated.cpp
[2/4] Compile Module.ShooterGame.cpp
ShooterGame.generated.cpp
Module.ShooterGame.cpp
[3/4] Link UE4Editor-ShooterGame-Win64-DebugGame.dll
[4/4] Link UE4Editor-ShooterGame-Win64-DebugGame.lib
Creating library D:\ShooterGame\Intermediate\Build\Win64\UE4Editor\DebugGame\UE4Editor-ShooterGame-Win64-DebugGame.lib and object D:\ShooterGame\Intermediate\Build\Win64\UE4Editor\DebugGame\UE4Editor-ShooterGame-Win64-DebugGame.exp
Creating library D:\ShooterGame\Intermediate\Build\Win64\UE4Editor\DebugGame\UE4Editor-ShooterGame-Win64-DebugGame.suppressed.lib and object D:\ShooterGame\Intermediate\Build\Win64\UE4Editor\DebugGame\UE4Editor-ShooterGame-Win64-DebugGame.suppressed.exp
ShooterGame.generated.cpp.obj : error LNK2019: unresolved external symbol "public: __cdecl UInterfacePickupable::UInterfacePickupable(class FObjectInitializer const &)" (??0UInterfacePickupable@@QEAA@AEBVFObjectInitializer@@@Z) referenced in function "void __cdecl InternalConstructor<class UInterfacePickupable>(class FObjectInitializer const &)" (??$InternalConstructor@VUInterfacePickupable@@@@YAXAEBVFObjectInitializer@@@Z)
dbsbuild : error : aborting build on error (1120)
D:\ShooterGame\Binaries\Win64\UE4Editor-ShooterGame-Win64-DebugGame.dll : fatal error LNK1120: 1 unresolved externals
ERROR : UBT error : Failed to produce item: D:\ShooterGame\Binaries\Win64\UE4Editor-ShooterGame-Win64-DebugGame.dll
What am I doing wrong ?
Thanks.