# \[C++\] Circular Dependencies in plugin modules

**URL:** <https://forums.unrealengine.com/t/c-circular-dependencies-in-plugin-modules/369597>\
**Category:** Plugins\
**Tags:** modules, unreal-engine, Plugins, question, CPP\
**Created:** [September 6, 2016, 9:04pm UTC](https://forums.unrealengine.com/t/c-circular-dependencies-in-plugin-modules/369597 "2016-09-06T21:04:31Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![MRCookie](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@MRCookie](https://forums.unrealengine.com/u/MRCookie)\
**Post date:** [September 6, 2016, 9:04pm UTC](https://forums.unrealengine.com/t/c-circular-dependencies-in-plugin-modules/369597/1 "2016-09-06T21:04:31Z")

</div>

**Hello!**

* * *

I’m making a plugin with 2 modules, which have to “cooperate” with each other (some of .cpp files include classes from another module and vice versa). My asset class created inside Runtime module need some data from Editor module. In other hand, my AssetTypeAction class declared inside Editor module need my asset class.

When I want to include some file from another plugin,I just add module name to DependencyModuleNames inside ModuleName.Build.cs. Unfortunately, when I did the same thing inside my second module build file,

```
EXEC : error : Action graph contains cycle!

```

… appears.

Anyone know how to solve this?

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_4b3639a6](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_4b3639a6](https://forums.unrealengine.com/u/anonymous_user_4b3639a6)\
**Post date:** [September 6, 2016, 10:54pm UTC](https://forums.unrealengine.com/t/c-circular-dependencies-in-plugin-modules/369597/2 "2016-09-06T22:54:43Z")

</div>

Hey Mr. Cookie  
Try it with forward declaration.

If you need a specific Object in a .h you can instead of

```
#include "SomeObject.h"

```

use

```
class SomeObject;

```

This means that you forward declared this Object. But beware that it is an incomplete type then. (You cannot use the functions provided by “SomeObject”)  
IF you want a complete type in your .cpp you can include it there.

Greetings

---

<div class="post-metadata">

**Author:** ![BrUnO\_XaVIeR](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/bruno_xavier/32/1110230_2.png) [@BrUnO\_XaVIeR](https://forums.unrealengine.com/u/BrUnO_XaVIeR)\
**Post date:** [September 7, 2016, 3:00am UTC](https://forums.unrealengine.com/t/c-circular-dependencies-in-plugin-modules/369597/3 "2016-09-07T03:00:55Z")

</div>

Never reference anything from Editor modules inside of Runtime plugins.  
You will break packaging for all games using your plugin.

---

<div class="post-metadata">

**Author:** ![MRCookie](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@MRCookie](https://forums.unrealengine.com/u/MRCookie)\
**Post date:** [September 8, 2016, 4:46pm UTC](https://forums.unrealengine.com/t/c-circular-dependencies-in-plugin-modules/369597/4 "2016-09-08T16:46:08Z")

</div>

My structural problem is a bit different (or maybe not). Inside Editor module I created classes that modify my asset ( Graph Editor, nodes to grah, graph scheme etc.), but I don’t need such classes during runtime. All methods using graph data are separated by #if WITH\_EDITOR.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_d16c9e49](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_d16c9e49](https://forums.unrealengine.com/u/anonymous_user_d16c9e49)\
**Post date:** [November 4, 2016, 7:23pm UTC](https://forums.unrealengine.com/t/c-circular-dependencies-in-plugin-modules/369597/5 "2016-11-04T19:23:21Z")

</div>

I’m having the same problem.

Did you find a solution?

---

<div class="post-metadata">

**Author:** ![bigTree2017](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@bigTree2017](https://forums.unrealengine.com/u/bigTree2017)\
**Post date:** [August 27, 2025, 8:52am UTC](https://forums.unrealengine.com/t/c-circular-dependencies-in-plugin-modules/369597/6 "2025-08-27T08:52:24Z")

</div>

ModuleB is the circle ref module，use this code :

```cpp
CircularlyReferencedDependentModules.Add(“ModuleB”);
```
