Error with including generated header files when using the Script Generator Plugin

Whenever I recompile my game code with the SGP targeting my game project, it will result in an error similar to this:

Test/Source/Test/Public/TestGameMode.h(4):
fatal error C1083: Cannot open include
file: ‘TestGameMode.generated.h’: No
such file or directory

What I do to accomplish this error is add “+ScriptSupportedModules=Test” to DefaultEngine.ini under “[Plugins]” in my UnrealHeaderTool config. Rebuild UHT and rebuild my game project.

Would anyone happen to know why this error occurs and how to fix it? I appreciate the help.

You need to add the (source) project depend on you target project. Say you have a class which have AClass.h and AClass.generated.h on you “Test” project. You want to use the AClass.h in you Plugin project.

So you need to open you Plugin *.Build.cs file, and add “Test” to PrivateDependencyModuleNames or PublicDependencyModuleNames