# Why does one of my declarations produce an error, while its twin works fine?

**URL:** <https://forums.unrealengine.com/t/why-does-one-of-my-declarations-produce-an-error-while-its-twin-works-fine/327456>\
**Category:** Programming & Scripting\
**Tags:** unreal-engine\
**Created:** [August 3, 2015, 5:26am UTC](https://forums.unrealengine.com/t/why-does-one-of-my-declarations-produce-an-error-while-its-twin-works-fine/327456 "2015-08-03T05:26:23Z")\
**Posts on this page:** 1\
**Showing post:** 16

<div class="post-metadata">

**Author:** ![anonymous\_user\_359f4d3c](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_359f4d3c](https://forums.unrealengine.com/u/anonymous_user_359f4d3c)\
**Post date:** [August 3, 2015, 9:54am UTC](https://forums.unrealengine.com/t/why-does-one-of-my-declarations-produce-an-error-while-its-twin-works-fine/327456/16 "2015-08-03T09:54:59Z")

</div>

Looks like a circular reference to me, especially if it works if you prefix the declaration with “class”.

If your MCharacter inherits from ACharacter, that means that MCharacter includes the character header (which includes Perception.h), while Perception.h also tries to include MCharacter.h.

To solve this, you need a forward declaration, which is precisely prefixing the declaration with class:

> **[A new, community-hosted Unreal Engine Wiki](https://forums.unrealengine.com/t/a-new-community-hosted-unreal-engine-wiki/141494)**
>
> After over a year in maintenance mode, the official Unreal Engine Wiki is now permanently offline. These resources now live on a new community-run Unreal Engine Community Wiki — https://unrealcommunity.wiki/! You will be able to find content from...

---

_[View the full topic](https://forums.unrealengine.com/t/why-does-one-of-my-declarations-produce-an-error-while-its-twin-works-fine/327456)._
