I have successfully created and compiled a blank plugin using the method described in the following tutorial:
which includes the following steps:- create new blank c++ Unreal project
- Add Plugins directory to the project directory
- create a PluginNAME folder within the plugins directory
- create the required files and folders within the PluginNAME directory
- build the plugin
The next thing I want to achieve is to include the source files from a different external c++ library in the plugin, so that I can link the external library with the Unreal engine.
The first problem I have run into is that Unreal expects all modules to have include statements, as stated in the following error:
Severity Code Description Project File Line Suppression State
Error Source file [PATH to external library cpp] is not including any headers. We expect all modules to include a header file for precompiled header generation. Please add an #include statement.
The external library I’m using is broken into individual modules. These modules are structured such that there are numerous .cpp files without include statements, and all of the .h files are included in global module include files. Seemingly, this structure wont work with Unreal’s expectation that all cpp files have include statements.
My Plugin directory looks like this:
- PluignNAME
- PluginNAME.uplugin
- Resources
- Source
- PluginNAME
- PluginNAME.Build.cs
- Private
- PluginNAME.h
- PluginNAMEPCH.h
- Module.cpp
- Module.h
- ExternalLibrarySource
- list of external library files
- PluginNAME
I only need to add the files to the VS project in order to get the error. It appears even if none of the external library files are #included or referenced anywhere in the plugin code.
My question: Is there any possible work-around in order to combine the include structure of the external library with the expected include structure of Unreal?
Am I mistaken when I assume that the error indicates that Unreal expects all .cpp files to have include statements? (I notice it mentions that “we expect all MODULES to include a header file …”) this indicates that there might be some way of structuring my plugin so that I don’t get this error …