Include header files from Plugin with modules

Hi!

I want to use C++ classes from a plugin in my game module. The code inside this plugin is split in modules.

What do I need to do to use it?

In the Game.Build.cs file I have added this:

PrivateDependencyModuleNames.AddRange(new string[] { "MyPlugin" });

PublicIncludePaths.AddRange(new string[] { "MyPlguin/Public" });

But it doesn’t compile.

The compiler doesn’t find this: #include <AModuleInPlugin/Public/UsefulFile.h>

How can I fix this problem?

Thanks!

Hello! You should add the name of the module as a dependency, rather than the name of the plugin.

PrivateDependencyModuleNames.AddRange(new string[] { "AModuleInPlugin" });

Then you should be able to include UsefulFile.h like so:

#include <UsefulFile.h>