# \[SOLVED\]C++ Interface not recognized as defined

**URL:** <https://forums.unrealengine.com/t/solved-c-interface-not-recognized-as-defined/362722>\
**Category:** UI\
**Tags:** interface, unreal-engine, CPP, question\
**Created:** [July 2, 2016, 5:34am UTC](https://forums.unrealengine.com/t/solved-c-interface-not-recognized-as-defined/362722 "2016-07-02T05:34:50Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Morgrhim](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Morgrhim](https://forums.unrealengine.com/u/Morgrhim)\
**Post date:** [July 2, 2016, 5:34am UTC](https://forums.unrealengine.com/t/solved-c-interface-not-recognized-as-defined/362722/1 "2016-07-02T05:34:50Z")

</div>

I have an interface I’m trying to implement in my current project, and I’ve run into a problem. On trying to compile, I get this list of errors:

 ![96893-unrealerroroccultainterface.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/4/a/24a58207f7e6d500bb44c8604f610370e1a7b839.png)

Here is the interface .h:

```
#pragma once
#include "Object.h"
#include "Inventory.h"
#include "BasePickup.h"
#include "InventoryI.generated.h"

UINTERFACE(MinimalAPI)
class UInventoryI : public UInterface
{
	GENERATED_UINTERFACE_BODY()	
};

class IInventoryI
{
	GENERATED_IINTERFACE_BODY()

public:
	virtual void StartSelection() = 0;
	virtual void EndSelection() = 0;
	virtual void OnTaken(UInventory* Inventory) = 0;
	virtual void OnItemSelected(ABasePickup* Item) = 0;
	virtual void DropItem(ABasePickup* Item, uint32 Amount = 0) = 0;
};

```

Here is the interface .cpp:

```
#include "OccultaMundi.h"
#include "InventoryI.h"

UInventoryI::UInventoryI(const class FObjectInitializer& ObjectInitializer) : Super(ObjectInitializer)
{

}

```

And here is the .h for the class where I’m implementing the interface:

```
#include "Components/ActorComponent.h"
#include "BasePickup.h"
#include "Inventory.generated.h"

UCLASS( ClassGroup=(Custom), meta=(BlueprintSpawnableComponent) )
class OCCULTAMUNDI_API UInventory : public UActorComponent, public IInventoryI
{
	GENERATED_BODY()

public:	
	// Sets default values for this component's properties
	UInventory();

	// Called when the game starts
	virtual void BeginPlay() override;
	
	// Called every frame
	virtual void TickComponent( float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction ) override;

	// Add to the inventory
	void AddToInventory(FInventoryItem* Item);

	// Remove from the inventory
	void RemoveFromInventory(FInventoryItem* Item);

	virtual void StartSelection() override;
	virtual void EndSelection() override;
	virtual void OnTaken(UInventory* Inventory) override;
	virtual void OnItemSelected(ABasePickup* Item) override;
	virtual void DropItem(ABasePickup* Item, uint32 Amount = 0) override;	

private:

	UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = Inventory, meta = (AllowPrivateAccess = "true"))
	TArray<FInventoryItem> InventoryItems;
};

```

I’ve tried everything I can think of to fix this, and I can’t find an existing question here that addresses this. Any ideas?

---

<div class="post-metadata">

**Author:** ![AlekseyIlin](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@AlekseyIlin](https://forums.unrealengine.com/u/AlekseyIlin)\
**Post date:** [July 2, 2016, 12:18pm UTC](https://forums.unrealengine.com/t/solved-c-interface-not-recognized-as-defined/362722/2 "2016-07-02T12:18:52Z")

</div>

AFAIK you can’t declare pure virtual methods in UE4 classes. Add empty definitions to your interface methods.

---

<div class="post-metadata">

**Author:** ![Morgrhim](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Morgrhim](https://forums.unrealengine.com/u/Morgrhim)\
**Post date:** [July 2, 2016, 12:53pm UTC](https://forums.unrealengine.com/t/solved-c-interface-not-recognized-as-defined/362722/3 "2016-07-02T12:53:35Z")

</div>

UInterfaces may have pure virtual functions in the second class in Unreal C++.

This isn’t a matter of how my functions are declared. Unreal isn’t letting my other class use the interface at all because it isn’t recognized as being defined at all.

---

<div class="post-metadata">

**Author:** ![AlekseyIlin](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@AlekseyIlin](https://forums.unrealengine.com/u/AlekseyIlin)\
**Post date:** [July 3, 2016, 7:48am UTC](https://forums.unrealengine.com/t/solved-c-interface-not-recognized-as-defined/362722/4 "2016-07-03T07:48:21Z")

</div>

I see it now: you forgot to #include your InventoryI interface
