Hello, i’m having troubles trying to make an interface with implemented function…
IArchivable.h
#pragma once
#include "Core.h"
#include "UObject/NoExportTypes.h"
#include "Interface.h"
#include "IArchivable.generated.h"
UINTERFACE(BlueprintType)
class A1_API UIArchivable : public UInterface
{
GENERATED_UINTERFACE_BODY()
};
class A1_API IIArchivable
{
GENERATED_IINTERFACE_BODY()
public :
UFUNCTION(BlueprintNativeEvent)
void ArchiveNecessity(int32 UniqueID);
virtual void ArchiveNecessity_Implementation(int32 UniqueID) override;
};
IArchivable.cpp
#include "IArchivable.h"
UIArchivable::UIArchivable(const class FObjectInitializer& ObjectInitializer)
: Super(ObjectInitializer)
{}
void IIArchivable::ArchiveNecessity_Implementation(int32 UniqueID) override
{
UE_LOG(LogTemp, Warning, TEXT("ArchiveNecessity pushed"));
}
I tryed a lots of things, there is a lot’s of topik and tutorial, i think i tryed all that was possible (even a full clean-build) and i don’t know where is the problem.
What is the working way to write that?
Compiler say that the func is already define in this exemple.
With different changes i can make it can say that “the func is not define” or already have a body… but never “ok it is define one time i accept it.”
There is 0 include of this file somewhere else, it’s a fresh class.
Here is the Generated file if you need it :
[SPOILER]
// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
/*===========================================================================
Generated code exported from UnrealHeaderTool.
DO NOT modify this manually! Edit the corresponding .h files instead!
===========================================================================*/
#include "UObject/ObjectMacros.h"
#include "UObject/ScriptMacros.h"
PRAGMA_DISABLE_DEPRECATION_WARNINGS
#ifdef A1_IArchivable_generated_h
#error "IArchivable.generated.h already included, missing '#pragma once' in IArchivable.h"
#endif
#define A1_IArchivable_generated_h
#define A2_Source_A1_Public_IArchivable_h_14_RPC_WRAPPERS \
virtual void ArchiveNecessity_Implementation(int32 UniqueID) {}; \
\
DECLARE_FUNCTION(execArchiveNecessity) \
{ \
P_GET_PROPERTY(UIntProperty,Z_Param_UniqueID); \
P_FINISH; \
P_NATIVE_BEGIN; \
P_THIS->ArchiveNecessity_Implementation(Z_Param_UniqueID); \
P_NATIVE_END; \
}
#define A2_Source_A1_Public_IArchivable_h_14_RPC_WRAPPERS_NO_PURE_DECLS \
\
DECLARE_FUNCTION(execArchiveNecessity) \
{ \
P_GET_PROPERTY(UIntProperty,Z_Param_UniqueID); \
P_FINISH; \
P_NATIVE_BEGIN; \
P_THIS->ArchiveNecessity_Implementation(Z_Param_UniqueID); \
P_NATIVE_END; \
}
#define A2_Source_A1_Public_IArchivable_h_14_EVENT_PARMS \
struct IArchivable_eventArchiveNecessity_Parms \
{ \
int32 UniqueID; \
};
#define A2_Source_A1_Public_IArchivable_h_14_CALLBACK_WRAPPERS
#define A2_Source_A1_Public_IArchivable_h_14_STANDARD_CONSTRUCTORS \
/** Standard constructor, called after all reflected properties have been initialized */ \
NO_API UIArchivable(const FObjectInitializer& ObjectInitializer = FObjectInitializer::Get()); \
DEFINE_DEFAULT_OBJECT_INITIALIZER_CONSTRUCTOR_CALL(UIArchivable) \
DECLARE_VTABLE_PTR_HELPER_CTOR(NO_API, UIArchivable); \
DEFINE_VTABLE_PTR_HELPER_CTOR_CALLER(UIArchivable); \
private: \
/** Private move- and copy-constructors, should never be used */ \
NO_API UIArchivable(UIArchivable&&); \
NO_API UIArchivable(const UIArchivable&); \
public:
#define A2_Source_A1_Public_IArchivable_h_14_ENHANCED_CONSTRUCTORS \
/** Standard constructor, called after all reflected properties have been initialized */ \
NO_API UIArchivable(const FObjectInitializer& ObjectInitializer = FObjectInitializer::Get()) : Super(ObjectInitializer) { }; \
private: \
/** Private move- and copy-constructors, should never be used */ \
NO_API UIArchivable(UIArchivable&&); \
NO_API UIArchivable(const UIArchivable&); \
public: \
DECLARE_VTABLE_PTR_HELPER_CTOR(NO_API, UIArchivable); \
DEFINE_VTABLE_PTR_HELPER_CTOR_CALLER(UIArchivable); \
DEFINE_DEFAULT_OBJECT_INITIALIZER_CONSTRUCTOR_CALL(UIArchivable)
#define A2_Source_A1_Public_IArchivable_h_14_GENERATED_UINTERFACE_BODY() \
private: \
static void StaticRegisterNativesUIArchivable(); \
friend struct Z_Construct_UClass_UIArchivable_Statics; \
public: \
DECLARE_CLASS(UIArchivable, UInterface, COMPILED_IN_FLAGS(CLASS_Abstract | CLASS_Interface), CASTCLASS_None, TEXT("/Script/A1"), NO_API) \
DECLARE_SERIALIZER(UIArchivable)
#define A2_Source_A1_Public_IArchivable_h_14_GENERATED_BODY_LEGACY \
PRAGMA_DISABLE_DEPRECATION_WARNINGS \
A2_Source_A1_Public_IArchivable_h_14_GENERATED_UINTERFACE_BODY() \
A2_Source_A1_Public_IArchivable_h_14_STANDARD_CONSTRUCTORS \
PRAGMA_ENABLE_DEPRECATION_WARNINGS
#define A2_Source_A1_Public_IArchivable_h_14_GENERATED_BODY \
PRAGMA_DISABLE_DEPRECATION_WARNINGS \
A2_Source_A1_Public_IArchivable_h_14_GENERATED_UINTERFACE_BODY() \
A2_Source_A1_Public_IArchivable_h_14_ENHANCED_CONSTRUCTORS \
private: \
PRAGMA_ENABLE_DEPRECATION_WARNINGS
#define A2_Source_A1_Public_IArchivable_h_14_INCLASS_IINTERFACE_NO_PURE_DECLS \
protected: \
virtual ~IIArchivable() {} \
public: \
typedef UIArchivable UClassType; \
typedef IIArchivable ThisClass; \
static void Execute_ArchiveNecessity(UObject* O, int32 UniqueID); \
virtual UObject* _getUObject() const { check(0 && "Missing required implementation."); return nullptr; }
#define A2_Source_A1_Public_IArchivable_h_14_INCLASS_IINTERFACE \
protected: \
virtual ~IIArchivable() {} \
public: \
typedef UIArchivable UClassType; \
typedef IIArchivable ThisClass; \
static void Execute_ArchiveNecessity(UObject* O, int32 UniqueID); \
virtual UObject* _getUObject() const { check(0 && "Missing required implementation."); return nullptr; }
#define A2_Source_A1_Public_IArchivable_h_11_PROLOG \
A2_Source_A1_Public_IArchivable_h_14_EVENT_PARMS
#define A2_Source_A1_Public_IArchivable_h_19_GENERATED_BODY_LEGACY \
PRAGMA_DISABLE_DEPRECATION_WARNINGS \
public: \
A2_Source_A1_Public_IArchivable_h_14_RPC_WRAPPERS \
A2_Source_A1_Public_IArchivable_h_14_CALLBACK_WRAPPERS \
A2_Source_A1_Public_IArchivable_h_14_INCLASS_IINTERFACE \
public: \
PRAGMA_ENABLE_DEPRECATION_WARNINGS
#define A2_Source_A1_Public_IArchivable_h_19_GENERATED_BODY \
PRAGMA_DISABLE_DEPRECATION_WARNINGS \
public: \
A2_Source_A1_Public_IArchivable_h_14_RPC_WRAPPERS_NO_PURE_DECLS \
A2_Source_A1_Public_IArchivable_h_14_CALLBACK_WRAPPERS \
A2_Source_A1_Public_IArchivable_h_14_INCLASS_IINTERFACE_NO_PURE_DECLS \
private: \
PRAGMA_ENABLE_DEPRECATION_WARNINGS
#undef CURRENT_FILE_ID
#define CURRENT_FILE_ID A2_Source_A1_Public_IArchivable_h
PRAGMA_ENABLE_DEPRECATION_WARNINGS
[/SPOILER]