Okay . Perhaps an alternative method we can try:
- Right click on your uproject file and click on “Generate Visual Studio Project Files”
- Open the YourProject.sln (where YourProject is the name of your UE4 Project)
- Set the configuration to shipping
- Compile
If you get no errors or warnings doing this, then try to package the build in UE4 as normal. I have found in the past that UE4 sometimes gets confused when compiling code in the editor, so I often compile it in Visual Studio and just let UE4 package the build.
Keep me posted!