Fatal Error C1083: Cannot open include file: 'xxx.generated.h': No such file or directory Unreal Engine 4 Plugins

I am trying to develop a game plugin for Unreal Engine 4.15. I’d like to do something with the FoliageType, so I include the FoliageType.h like this

#include "FoliageType.h"

(Unreal Engine has its own rule to include all .h file from the Public folders so if the .h file is inside a Public folder, you can just write #include “xxx.h”, no more relative or absolute path is needed.)

Then, I compile my project, I get the error “fatal error C1083: Cannot open include file: ‘FoliageType.generated.h’: No such file or directory”.

The way to solve this error is adding “Foliage” to the PublicDependencyModuleNames in the PluginName.Build.cs file and regenerate your Visual Studio project files (right click the uproject file to open this. In this case this the generating project step isn’t necessary. The way I understand this generating project step is it updates the solution files tree in Visual Studio or any other IDEs, so if you put some new source files in the project but you can’t see them in Visual Studio, this generating process will solve it. Another usage of this process is it creates the xxx.generated.h files.).

My guess is because I’ve included the FoliageType.h, my plugin is dependent on the Foliage Module so I have to add it.

2 Replies to “Fatal Error C1083: Cannot open include file: 'xxx.generated.h': No such file or directory Unreal Engine 4 Plugins”

Comments are closed.