Hi, I’m pretty new to UE4 C++ and I have a little problem with an interface. I followed a guide on the wiki and i ended up with this code:
.h
#pragma once
#include "GamemodeInterface.generated.h"
UINTERFACE(Blueprintable)
class UGamemodeInterface : public UInterface
{
GENERATED_UINTERFACE_BODY()
};
class IGamemodeInterface
{
GENERATED_IINTERFACE_BODY()
public:
UFUNCTION(BlueprintNativeEvent, BlueprintCallable, Category = "Game Mode")
void EnemyKilledCallback();
UFUNCTION(BlueprintNativeEvent, BlueprintCallable,Category = "Game Mode")
void PlayerKilledCallback();
};
.cpp
#include "UntillLight.h"
#include "GamemodeInterface.h"
void IGamemodeInterface::EnemyKilledCallback()
{
}
void IGamemodeInterface::PlayerKilledCallback()
{
}
UGamemodeInterface::UGamemodeInterface(const class FObjectInizializer& PCIP) : Super(PCIP)
{
}
When I try to compile i always get these erros:
2>D:\Develop\Unreal Projects\UntillLight\Source\UntillLight\GamemodeInterface.cpp(14): error C2511: 'UGamemodeInterface::UGamemodeInterface(const FObjectInizializer &)': overloaded member function not found in 'UGamemodeInterface'
2> d:\develop\unreal projects\untilllight\source\untilllight\GamemodeInterface.h(11): note: see declaration of 'UGamemodeInterface'
2>D:\Develop\Unreal Projects\UntillLight\Source\UntillLight\GamemodeInterface.cpp(15): error C2550: 'UGamemodeInterface::{ctor}': constructor initializer lists are only allowed on constructor definitions
2> UntillLight.cpp
2> UntillLight.generated.cpp
2>ERROR : UBT error : Failed to produce item: D:\Develop\Unreal Projects\UntillLight\Binaries\Win64\UE4Editor-UntillLight.dll
What is wrong in my code, i really can’t find it?