[C++] Circular Dependencies in plugin modules

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?

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

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

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.

I’m having the same problem.

Did you find a solution?