# Adding Unreal Interface Does Not Compile

**URL:** <https://forums.unrealengine.com/t/adding-unreal-interface-does-not-compile/419299>\
**Category:** UI\
**Tags:** interface, unreal-engine, UInterface, CPP, question\
**Created:** [March 8, 2018, 4:59pm UTC](https://forums.unrealengine.com/t/adding-unreal-interface-does-not-compile/419299 "2018-03-08T16:59:34Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous\_user\_ef52b559](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_ef52b559](https://forums.unrealengine.com/u/anonymous_user_ef52b559)\
**Post date:** [March 8, 2018, 4:59pm UTC](https://forums.unrealengine.com/t/adding-unreal-interface-does-not-compile/419299/1 "2018-03-08T16:59:34Z")

</div>

When I an Unreal interface with the engine, I get the following compilation errors. I’ve also included the code that is generated by Unreal.

PickupInterface.h(11): error C2504: ‘UInterface’: base class undefined

PickupInterface.h(12): error C3646: ‘Super’: unknown override specifier

PickupInterface.h(12): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int

PickupInterface.h(12): error C2614: ‘UPickupInterface’: illegal member initialization: ‘Super’ is not a base or member

PickupInterface.h(12): error C2440: ‘return’: cannot convert from ‘UPickupInterface \*’ to ‘UObject \*’

PickupInterface.h(12): note: Types pointed to are unrelated; conversion requires reinterpret\_cast, C-style cast or function-style cast

```
#pragma once

#include "CoreMinimal.h"
#include "PickupInterface.generated.h"

// This class does not need to be modified.
UINTERFACE(MinimalAPI)
class UPickupInterface : public UInterface
{
	GENERATED_BODY()
};

/**
 * 
 */
class TOMBWORLD_API IPickupInterface
{
	GENERATED_BODY()

	// Add interface functions to this class. This is the class that will be inherited to implement this interface.
public:
	
	
};

```

---

<div class="post-metadata">

**Author:** ![Atheist91](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Atheist91](https://forums.unrealengine.com/u/Atheist91)\
**Post date:** [March 8, 2018, 8:50pm UTC](https://forums.unrealengine.com/t/adding-unreal-interface-does-not-compile/419299/2 "2018-03-08T20:50:29Z")

</div>

Hey there.

Have you tried including **Interface.h**?

```
#include "UObject/Interface.h"

```

From what I see, it’s not directly included in **CoreMinimal.h**. It might be somewhere deeper tho.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_ef52b559](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_ef52b559](https://forums.unrealengine.com/u/anonymous_user_ef52b559)\
**Post date:** [March 8, 2018, 9:25pm UTC](https://forums.unrealengine.com/t/adding-unreal-interface-does-not-compile/419299/3 "2018-03-08T21:25:46Z")

</div>

I am incredibly confused. I added the Interface header, and it still failed. I added core minimal, same thing. Swapped the order and it worked. Then I removed both and it still compiles. I have no idea why, there is nothing else I changed. Thanks for the help, I do wish I knew what the issue was though.

---

<div class="post-metadata">

**Author:** ![Atheist91](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Atheist91](https://forums.unrealengine.com/u/Atheist91)\
**Post date:** [March 8, 2018, 9:29pm UTC](https://forums.unrealengine.com/t/adding-unreal-interface-does-not-compile/419299/4 "2018-03-08T21:29:23Z")

</div>

It seemed kind of odd that you had this error in the first place. I can’t remember if I ever had to include this header explicitly anywhere in my code actually. Maybe forcing VS to actually recompile your stuff fixed the issue. That’s actually quite common solution. 😛

---

<div class="post-metadata">

**Author:** ![killowatt](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@killowatt](https://forums.unrealengine.com/u/killowatt)\
**Post date:** [March 20, 2018, 7:13pm UTC](https://forums.unrealengine.com/t/adding-unreal-interface-does-not-compile/419299/5 "2018-03-20T19:13:12Z")

</div>

I am not sure if I am experiencing the same thing but in a different form, but it maybe has to do with in what order you include the Interface header file, as it compiled fine until I moved the #include for the interface in my other classes to right before the .generated.h file. Not sure though

---

<div class="post-metadata">

**Author:** ![maxmurks](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@maxmurks](https://forums.unrealengine.com/u/maxmurks)\
**Post date:** [October 4, 2020, 7:55pm UTC](https://forums.unrealengine.com/t/adding-unreal-interface-does-not-compile/419299/6 "2020-10-04T19:55:35Z")

</div>

I have the same problem and was working 2 days on it being confused. My code was the same as the example and it just wouldn’t work. But somehow, switching some property orders or moving the #import made me able to compile? I have no idea what the problem is but hopefully the #import is the answer and it’ll work from now on.
