# How to include private header files of other Modules into my Module?

**URL:** <https://forums.unrealengine.com/t/how-to-include-private-header-files-of-other-modules-into-my-module/325438>\
**Category:** Plugins\
**Tags:** include, modules, uht, unreal-engine, editor, Plugins, question\
**Created:** [July 16, 2015, 5:26am UTC](https://forums.unrealengine.com/t/how-to-include-private-header-files-of-other-modules-into-my-module/325438 "2015-07-16T05:26:08Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Stane](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Stane](https://forums.unrealengine.com/u/Stane)\
**Post date:** [July 16, 2015, 5:26am UTC](https://forums.unrealengine.com/t/how-to-include-private-header-files-of-other-modules-into-my-module/325438/1 "2015-07-16T05:26:08Z")

</div>

Hi,

I try to create a Plugin with an editor module for a component Visualizer.  
I have trouble in understanding and setting up the MyToolEditor.Build.cs  
I want to extent an already existing Component Visualizer but this Visualizer is declared in the private Folder of the ComponentVisualizers Module.

My Question is, how could I access this?  
**How can I include private header files of other Modules?**

I tried something like this, but with no luck

```
PrivateIncludePaths.AddRange(
	new string[] {
		"MyToolEditor/Private", 
		"Editor/ComponentVisualizers/Private"
	}
);
```

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_ac78c893](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_ac78c893](https://forums.unrealengine.com/u/anonymous_user_ac78c893)\
**Post date:** [October 8, 2015, 6:21pm UTC](https://forums.unrealengine.com/t/how-to-include-private-header-files-of-other-modules-into-my-module/325438/2 "2015-10-08T18:21:07Z")

</div>

I’ve tried to do that in many ways without success, but finally nailed it!

This works for engine modules:

```
using System.IO; // Note this import, it's needed below

namespace UnrealBuildTool.Rules
{
    public class Foo : ModuleRules
    {
        public Foo(TargetInfo Target)
        {
            // ...
            // Get the engine path. Ends with "Engine/"
            string engine_path = Path.GetFullPath(BuildConfiguration.RelativeEnginePath);
            // Now get the base of UE4's modules dir (could also be Developer, Editor, ThirdParty)
            string srcrt_path = engine_path + "Source/Runtime/";
    
            // now you can include the module's private paths!
            // as an example, you can expose UE4's abstraction of D3D11, located in Source/Runtime/Windows/D3D11RHI
            PublicIncludePaths.Add(srcrt_path + "Windows/D3D11RHI/Private");
            PublicIncludePaths.Add(srcrt_path + "Windows/D3D11RHI/Private/Windows");
        }
    }
}

```

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_6dbe8be9](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_6dbe8be9](https://forums.unrealengine.com/u/anonymous_user_6dbe8be9)\
**Post date:** [November 11, 2015, 3:02am UTC](https://forums.unrealengine.com/t/how-to-include-private-header-files-of-other-modules-into-my-module/325438/3 "2015-11-11T03:02:07Z")

</div>

Thanks for posting your solution! Helped me solve the same issue today!

---

<div class="post-metadata">

**Author:** ![grisevg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@grisevg](https://forums.unrealengine.com/u/grisevg)\
**Post date:** [March 24, 2016, 5:48pm UTC](https://forums.unrealengine.com/t/how-to-include-private-header-files-of-other-modules-into-my-module/325438/4 "2016-03-24T17:48:48Z")

</div>

You rock! Thanks!

---

<div class="post-metadata">

**Author:** ![StealthOne](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@StealthOne](https://forums.unrealengine.com/u/StealthOne)\
**Post date:** [August 9, 2016, 11:53pm UTC](https://forums.unrealengine.com/t/how-to-include-private-header-files-of-other-modules-into-my-module/325438/5 "2016-08-09T23:53:12Z")

</div>

This was helpful! Thanks!

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_bac43b8b](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_bac43b8b](https://forums.unrealengine.com/u/anonymous_user_bac43b8b)\
**Post date:** [February 18, 2017, 9:55am UTC](https://forums.unrealengine.com/t/how-to-include-private-header-files-of-other-modules-into-my-module/325438/6 "2017-02-18T09:55:16Z")

</div>

Where I have to write this?

---

<div class="post-metadata">

**Author:** ![Phyronnaz](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Phyronnaz](https://forums.unrealengine.com/u/Phyronnaz)\
**Post date:** [September 24, 2017, 12:47am UTC](https://forums.unrealengine.com/t/how-to-include-private-header-files-of-other-modules-into-my-module/325438/7 "2017-09-24T00:47:23Z")

</div>

Thanks! 🙂

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_88d57b37](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_88d57b37](https://forums.unrealengine.com/u/anonymous_user_88d57b37)\
**Post date:** [March 13, 2018, 2:06pm UTC](https://forums.unrealengine.com/t/how-to-include-private-header-files-of-other-modules-into-my-module/325438/8 "2018-03-13T14:06:09Z")

</div>

since 4.18:

string engine\_path = Path.GetFullPath( **Target**.RelativeEnginePath);

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_a062877a](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_a062877a](https://forums.unrealengine.com/u/anonymous_user_a062877a)\
**Post date:** [June 15, 2018, 4:54pm UTC](https://forums.unrealengine.com/t/how-to-include-private-header-files-of-other-modules-into-my-module/325438/9 "2018-06-15T16:54:43Z")

</div>

Your \*.Build.cs file for the project.

---

<div class="post-metadata">

**Author:** ![nikolai.shkurkin](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/nikolai.shkurkin/32/892695_2.png) [@nikolai.shkurkin](https://forums.unrealengine.com/u/nikolai.shkurkin)\
**Post date:** [May 9, 2024, 10:13pm UTC](https://forums.unrealengine.com/t/how-to-include-private-header-files-of-other-modules-into-my-module/325438/10 "2024-05-09T22:13:44Z")

</div>

I came across this post and figured I would add an example I see used in other Engine code. In my case I wanted to access private headers from Slate in my own Editor tool code. I added the following in by .Build.cs file:

```auto
PrivateIncludePaths.AddRange(new string[] {
    System.IO.Path.Combine(GetModuleDirectory("Slate"), "Private"),
});

```

I can then include the header I’m after (Engine/Source/Runtime/Slate/Private/Framework/Docking/SDockingTabStack.h) as

```auto
#include "Framework/Docking/SDockingTabStack.h"

```

Cheers.
