Factory.generated.h can't be found when including Factory.h from a plugin

When I include Factory.h in my plugin I get the following build errors:

1>C:\Program Files\Unreal Engine\4.10\Engine\Source\Editor/UnrealEd/Classes/Factories/Factory.h(10): fatal error C1083: Cannot open include file: 'Factory.generated.h': No such file or directory
1>C:\Program Files\Unreal Engine\4.10\Engine\Source\Editor/UnrealEd/Classes/Factories/Factory.h(10): fatal error C1083: Cannot open include file: 'Factory.generated.h': No such file or directory
1>C:\Program Files\Unreal Engine\4.10\Engine\Source\Editor/UnrealEd/Classes/Factories/Factory.h(10): fatal error C1083: Cannot open include file: 'Factory.generated.h': No such file or directory
1>C:\Program Files\Unreal Engine\4.10\Engine\Source\Editor\UnrealEdMessages\Classes\AssetEditorMessages.h(5): fatal error C1083: Cannot open include file: 'AssetEditorMessages.generated.h': No such file or directory

Build.cs for the plugin:

using UnrealBuildTool;

public class SkillSystem : ModuleRules
{
	public SkillSystem(TargetInfo Target)
	{
		
		PublicIncludePaths.AddRange(
			new string[]
			{
				"SkillSystem/Public",
				
			}
			);
				
		
		PrivateIncludePaths.AddRange(
			new string[]
			{
				"SkillSystem/Private",
				"Developer/AssetTools/Public", // Seems like this line isn't actually needed.
				"Editor/UnrealEd/Classes/Factories", // Seems like this line isn't actually needed.

			}
			);

		PrivateIncludePathModuleNames.AddRange(
			new string[]
			{
				
			}
			);
			
		
		PublicDependencyModuleNames.AddRange(
			new string[]
			{
				"Core",

			}
			);
			
		
		PrivateDependencyModuleNames.AddRange(
			new string[]
			{
				"CoreUObject",
				"Engine",
				"Slate",
				"SlateCore",
				"UnrealEd", // Also added "UnrealEdMessages" here, but it doesn't solve the AssetEditorMessages error.
				"AssetTools",

			}
			);
		
		
		DynamicallyLoadedModuleNames.AddRange(
			new string[]
			{
				
			}
			);
	}
}

The header that includes it (located in the Private folder of my plugin’s source) – note that I have two of those header files in my plugin, the other one is an exact copy but with a different class name:

#pragma once
// Includes (include generated file to enable UHT to parse this file).
#include "Editor/UnrealEd/Classes/Factories/Factory.h" // Switched this out with "UnrealEd.h" and it removes the first 3 errors.
#include "SkillFactory.generated.h"
/**
 * Implements UFactory to allow references as assets in the editor.
 */
UCLASS()
class USkillFactory : public UFactory
{
	GENERATED_BODY()

public:
	/** Default constructor. */
	USkillFactory();
	/**
	* Implement the UFactory interface.
	* This allows referencing the given class as an asset.
	*/
	virtual UObject* FactoryCreateNew(UClass* InClass, UObject* InParent, FName InName, EObjectFlags Flags, UObject* Context, FFeedbackContext* Warn) override;
};

The files for my plugin are in Game/Plugins/Name/Source/Name/ and then split between Public and Private. Both headers in question are in the Private folder.

Note that the headers that include Factory.h are in the private folder, hence why the Dependencies are private. Additionally, I’ve tried including Object.h before the Factory.h include since it inherits from it, but it seems to be the only dependency for Factory.h, so maybe I’m missing a module or something else.

I’ve also tried including “Factory.h” only instead of the full path, in that case it simply doesn’t find the file.

1>c:\users\saume\workspace\dungeonhunter\plugins\skillsystem\source\skillsystem\private\SkillFactory.h(6): fatal error C1083: Cannot open include file: 'Factory.h': No such file or directory
1>c:\users\saume\workspace\dungeonhunter\plugins\skillsystem\source\skillsystem\private\SkillModifierFactory.h(6): fatal error C1083: Cannot open include file: 'Factory.h': No such file or directory
1>C:\Users\Saume\Workspace\DungeonHunter\Plugins\SkillSystem\Source\SkillSystem\Private/SkillFactory.h(6): fatal error C1083: Cannot open include file: 'Factory.h': No such file or directory
1>C:\Program Files\Unreal Engine\4.10\Engine\Source\Editor\UnrealEdMessages\Classes\AssetEditorMessages.h(5): fatal error C1083: Cannot open include file: 'AssetEditorMessages.generated.h': No such file or directory

----------- EDIT: ---------------

I solved the Factory.h problem by changing the include from “Factory.h” to “UnrealEd.h”, however, the other error remains:

1>C:\Program Files\Unreal Engine\4.10\Engine\Source\Editor\UnrealEdMessages\Classes\AssetEditorMessages.h(5): fatal error C1083: Cannot open include file: 'AssetEditorMessages.generated.h': No such file or directory
1>C:\Program Files\Unreal Engine\4.10\Engine\Source\Editor\UnrealEdMessages\Classes\AssetEditorMessages.h(5): fatal error C1083: Cannot open include file: 'AssetEditorMessages.generated.h': No such file or directory

I have included “UnrealEdMessages” module in the build and it still doesn’t work. I’ve also tried moving both UnrealEd and UnrealEdMessages to public dependencies just in case and it didn’t fix it. I’ve also tried including “UnrealEdMessages.h” before and after “UnrealEd.h” and the error was still there.

-------------- EDIT 2: --------------

Potentially related to 4.9 bug (though that seems to indicate that your plugin’s name needed to start with a number, which isn’t my case):

Did you ever get this resolved? I’m having similar issues when trying to create an anim bp node in my editor module…can’t find AnimGraphNode_Base.generated.h

Nope, it seems to be a bug on UE’s side, I’ve tried the same setup, but with the code setup as a different module instead of a plugin and the same error happens, however, from within the main game module everything works fine. Seems like there are problems including editor files from outside the main module.

Figured my issue out. Wasn’t including the right dependency module (AnimGraph in my case)