# UAT build error when c++ module contains only unreferenced APIs

**URL:** <https://forums.unrealengine.com/t/uat-build-error-when-c-module-contains-only-unreferenced-apis/423478>\
**Category:** Platform & Builds\
**Tags:** Cooking, uat, c-build-fail, unreal-engine, build-failed, question\
**Created:** [April 24, 2018, 5:52pm UTC](https://forums.unrealengine.com/t/uat-build-error-when-c-module-contains-only-unreferenced-apis/423478 "2018-04-24T17:52:47Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous\_user\_831d0093](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_831d0093](https://forums.unrealengine.com/u/anonymous_user_831d0093)\
**Post date:** [April 24, 2018, 5:52pm UTC](https://forums.unrealengine.com/t/uat-build-error-when-c-module-contains-only-unreferenced-apis/423478/1 "2018-04-24T17:52:47Z")

</div>

Repro:

- UE4.19.1 (built from source)

- Create a default BP ThirdPerson project. Load in Editor. Confirm you can play. Quit.

- Build from Command line for Win64 Release or Development, for example…  
“%\_UnrealAutomationToolExe%” BuildCookRun -noP4 -project=%\_ProjectFile% -platform=%\_BuildTarget% -clientconfig=%\_BuildConfiguration% -serverconfig=%\_BuildConfiguration% -cook -allmaps -build -stage -pak -archivedirectory=%\_AppLayoutRoot%

RESULT: Build Success

- Re-open the project and create a simple C++ class. Build/run in the editor. Close the Editor.

- Clean and build from Command line (same as above)

RESULT: Build failure…

ERROR: Cook failed.  
(see D:\Root\Projects\Tools\UE4\Engine\Programs\AutomationTool\Saved\Logs\UAT\_Log.txt for full exception trace)

# CommandletException: Editor terminated with exit code 1 while running Cook for D:\Root\Projects\Projects\TestBuild2\Game\TestBuild2.uproject; see log D:\Root\Projects\Tools\UE4\Engine\Programs\AutomationTool\Saved\Logs\Cook-2018.04.23-14.40.42.txt at AutomationTool.CommandUtils.RunCommandlet(FileReference ProjectName, String UE4Exe, String Commandlet, String Parameters) in D:\Root\Tools\UE4\Engine\Source\Programs\AutomationTool\AutomationUtils\CommandletUtils.cs:line 372 at AutomationTool.CommandUtils.CookCommandlet(FileReference ProjectName, String UE4Exe, String Maps, String Dirs, String InternationalizationPreset, String CulturesToCook, String TargetPlatform, String Parameters) in D:\Root\Tools\UE4\Engine\Source\Programs\AutomationTool\AutomationUtils\CommandletUtils.cs:line 94 at Project.Cook(ProjectParams Params) in D:\Root\Tools\UE4\Engine\Source\Programs\AutomationTool\Scripts\CookCommand.Automation.cs:line 257 Wrapped by AutomationException: Cook failed. at Project.Cook(ProjectParams Params) in D:\Root\Tools\UE4\Engine\Source\Programs\AutomationTool\Scripts\CookCommand.Automation.cs:line 271 at BuildCookRun.DoBuildCookRun(ProjectParams Params) in D:\Root\Tools\UE4\Engine\Source\Programs\AutomationTool\Scripts\BuildCookRun.Automation.cs:line 209 at BuildCookRun.ExecuteBuild() in D:\Root\Tools\UE4\Engine\Source\Programs\AutomationTool\Scripts\BuildCookRun.Automation.cs:line 41 at AutomationTool.BuildCommand.Execute() in D:\Root\Tools\UE4\Engine\Source\Programs\AutomationTool\AutomationUtils\BuildCommand.cs:line 100 at AutomationTool.Automation.Execute(List`1 CommandsToExecute, Dictionary`2 Commands) in D:\Root\Tools\UE4\Engine\Source\Programs\AutomationTool\AutomationUtils\Automation.cs:line 557 at AutomationTool.Automation.Process(String Arguments) in D:\Root\Tools\UE4\Engine\Source\Programs\AutomationTool\AutomationUtils\Automation.cs:line 527 at AutomationTool.Program.MainProc(Object Param) in D:\Root\Tools\UE4\Engine\Source\Programs\AutomationTool\Program.cs:line 132 at AutomationTool.InternalUtils.RunSingleInstance(Func`2 Main, Object Param) in D:\Root\Tools\UE4\Engine\Source\Programs\AutomationTool\AutomationUtils\Utils.cs:line 712 at AutomationTool.Program.Main() in D:\Root\Tools\UE4\Engine\Source\Programs\AutomationTool\Program.cs:line 62

AutomationTool exiting with ExitCode=25 (Error\_UnknownCookFailure)  
App Build Failed (ERRORLEVEL = 25). See D:\Builds\Projects\TestBuild2\TestBuild2\_20180423.1\Logs\AppLayout\_Debug\_Win64.log for details.  
Build Failed (ERRORLEVEL = 25)

Looking up the log, we can see that our default generated Editor module wasn’t built…

LogInit: Warning: Incompatible or missing module: UE4Editor-TestBuild2.dll

- Re-open the project and create an Actor-derived C++ class and create an instance in the main scene (now it is used/referenced). Build/run in the editor. Close the Editor.

- Clean and build from Command line (same as above)

RESULT: Build Success

Theory: API stripping during cook is ejecting the game modules due to unreferenced code, but the module is still being included in the bill of materials (BoM) for the layout. Feels like a bug.

Request: Please point me at documentation WRT cooking and API stripping rules. Also documentation WRT how to mark C++/Blueprints such that they aren’t rejected by that process.

- Appreciated
