C:\Users\James\Users\James\Desktop\ST_SparseGridBuild\HostProject\Plugins\ST_SparseGrid\Source\ST_SparseGrid\ST_SparseGrid.build.cs: warning: Referenced directory 'E:\Program Files\Epic Games\UE_4.20\Engine\Source\ST_SparseGrid\Public' does not exist.
Why is UBT / UAT looking in the engine directory for my plugin files and content - it should be looking where I’m building the plugin from?
I’m also unable to package it from the editor for exactly the same reason. If this behaviour has changed, why are there no release notes on it?
You need to use full relative paths from the PublicIncludePath directory you are adding. So if ‘Folder1’ is a subfolder inside ‘ST_SparseGrid/Public’ of try something like
That’s correct @dingtech; as of 4.20, base include paths relative to the “Public” directory of Engine source files have been added to reduce the number of public include paths needed for Engine modules. However, you may use ModuleDirectory and EngineDirectory properties if you’d like to root to a particular directory. As you folks have already figured out, if you’re u[FONT=courier new]sing System.IO; the following syntax can be used where “MyFolder” is the name of the directory under the current module you’d like to include:
[FONT=courier new]PublicIncludePaths.Add(Path.Combine(ModuleDirectory, “MyFolder”));
@Monomyth I’ve made these changes, I’m still having trouble compiling. The directories are being found now with the above change (although it’s kind of annoying having to list all the sub-folders manually now).
The problem now is, it’s complaining about files not including headers in the correct order - even though they are. Here’s the log from UAT:
ProcessResult.StdOut: Reflection code generated for UE4Editor in 14.4092065 seconds
ProcessResult.StdOut: C:\Users\James\Desktop\Users\James\Desktop\ST_SparseGridBuild\HostProject\Plugins\ST_SparseGrid\Source\ST_SparseGridEditor\Private\Slate\ST_SGDataDetails.cpp(1): error: Expected ST_SGDataDetails.h to be first header included.
ProcessResult.StdOut: ERROR: Build canceled.
And here is the file in question. You can clearly see that ST_SGDataDetails.h IS the first included file. I’ve never had so much trouble compiling anything…
I see you’ve already added:
[FONT=courier new]PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;
to your plugin’s .build.cs file(s), but the errors guiding you to be IWYU-compliant seem to be erroneous (if the first header expected is, in fact, the first one included). If you’re compiling in VS, are you clearing Binaries/Intermediate folders before attempting the build with a new .sln? If that doesn’t work, make sure to try to build the plugin from the editor or directly invoke UAT’s BuildPlugin command.
Thanks - I ended up building through the editor instead, and got some different errors (related to IWYU) which I set about fixing, and everything was fine after that. I’ve finally been able to submit to the Marketplace! Strange that the editor vs invoking UAT directly would create different errors mind…
Im getting the same issue where its looking for the plugin public folder at the Engine directory, rather than where im building it from, however i have alredy added using System.IO and the Public & Private include paths
using UnrealBuildTool;
using System.IO;
public class MeleeTrace : ModuleRules
{
public MeleeTrace(ReadOnlyTargetRules Target) : base(Target)
{
PCHUsage = ModuleRules.PCHUsageMode.UseExplicitOrSharedPCHs;
PublicIncludePaths.Add(Path.Combine(ModuleDirectory, "Public"));
PrivateIncludePaths.Add(Path.Combine(ModuleDirectory, "Private"));
PublicDependencyModuleNames.AddRange(
new string]
{
"Core",
}
);
PrivateDependencyModuleNames.AddRange(
new string]
{
"CoreUObject",
"Engine",
"Slate",
"SlateCore",
}
);
DynamicallyLoadedModuleNames.AddRange(
new string]
{
}
);
}
}
It compiles just fine trough both VS and the editor. however using the UAT BuildPlugin command fails with this error
\MeleeTrace\MeleeTrace.Build.cs: warning: Referenced directory 'C:\Program Files\Epic Games\UE_4.20\Engine\Source\MeleeTrace\Public' does not exist.
ModuleDirectory does help anyone when your solution has a dozen custom modules. You can reference the current module, or Engine Module, but not a seperate module. This change has gone from people not understanding how the build.cs files work, to the build.cs files simply not working.