This is the structure of my plugin’s modules:
[MODULE A] <-- Runtime Module
- Public
- File 1.h
- FolderA
- File 2.h
- Private
- Files .h and .cpp
-FolderA
- File 2.cpp
- File 3.h and .cpp
[MODULE B] <-- Editor module. Uses Module A.
- Public (only headers)
- Private (headers, subfolders, and source files)
Here’s my reasoning:
Module B requires access to Module A’s File 2 (a header), so I move it out of Private folder inside a subfolder with the same name under Public.
To require access to only public headers, Module B should add “ModuleA” to the PrivateDependencyModuleNames variable, since it is only used in the private files of Module B.
Here are my questions:
-
I cannot compile this. File 2.h includes File 3.h and it’s not found. How’s that possible??. The private folder is included under PrivateIncludePaths list by default. I tried adding the path /FolderA/ too, but it doesn’t find it. I also tried adding it to the PublicIncludePaths (it’s not very clear which one it should be).
-
Is it mandatory to move header files to the public folder of a module to be able to use them, in this case, from module B? File 2 is just a derived actor component class that I need to store on a pointer from the editor module B.
-
Should I add “ModuleA” under ModuleB.build.cs file to the PrivateDependencyModuleNames list? or instead add it on PrivateIncludePaths, or PublicIncludePaths, or PrivateIncludePathModuleNames… confusing documentation, confusing choice, really.
-
In case it’s not a module Name but an include path what I need to add, should I add the path to the FolderA too?