Interface in 4.8

I’m attempting to get a simple interface added in UE4 in C++. Unfortunately, I’ve been unable to get the interface to work correctly. I’m getting a couple of errors:

error C3668: ‘APhoenixCharacter::GetEnergy’ : method with override specifier ‘override’ did not override any base class methods

and

error C2512: ‘IPhoenixInterface’ : no appropriate default constructor available.

Any help would be much appreciated.

Interface.h

UINTERFACE(Blueprintable, Category = "Phoenix Interface")
class PHOENIX_API UPhoenixInterface : public UInterface
{
	GENERATED_UINTERFACE_BODY()

public:
};

class IPhoenixInterface
{
	GENERATED_IINTERFACE_BODY()

public:

	IPhoenixInterface(const FObjectInitializer & PCIP);

	//UFUNCTION(BlueprintImplementableEvent)
		float GetEnergy();
};

Interface.cpp

UPhoenixInterface::UPhoenixInterface(const FObjectInitializer & PCIP)
: Super(PCIP)
{

}

IPhoenixInterface::IPhoenixInterface(const FObjectInitializer & PCIP = FObjectInitializer::Get())
{

}

float IPhoenixInterface::GetEnergy()
{
	return 1.0f;
}

character.h

UCLASS()
class PHOENIX_API APhoenixCharacter : public ACharacter, public IPhoenixInterface
{
	GENERATED_BODY()

	//Interface Overrides
public:
	//UFUNCTION(BlueprintImplementableEvent)
		float GetEnergy() override;

Have you tried changing the cpp constructor implementation (on line 25 above) to:

UPhoenixInterface::UPhoenixInterface(const FObjectInitializer& ObjectInitializer)
	: Super(ObjectInitializer)
{
}

and removing the function declared on line 17 and 31?

Static is right, the default constructor should get automatically declared when you use the macro

GENERATED_UINTERFACE_BODY()

you’ll also need to declare IPhoenixInterface::GetEnergy as virtual if you want to override it

virtual float GetEnergy();

I changed the constructor to what you specified. I still get the same error:

error C2512: ‘IPhoenixInterface’ : no appropriate default constructor available

Virtual float doesn’t work with blueprintimplementable, but I changed it to virtual and it still throws the constructor error for the interfaces.

Did you remove the declaration on line 17 and the implementation on line 31 as well ?