Packaging build error : Starts compiling engine and fails

Hi all,

I am trying to package my game but I am getting build errors. I am adding a snippet of the output log here :

MainFrameActions: Packaging (Windows): CommandUtils.Run: Run: C:\User\Study\animation\code\ue4\Engine\Binaries\DotNET\UnrealBuildTool.exe TaskBasedLM Win64 DebugGame  "C:\Users\User\Documents\Unreal Projects\TaskBasedLMDepot\Experimental\taskbasedlm\TaskBasedLM.uproject"  -noxge
MainFrameActions: Packaging (Windows): UnrealBuildTool: Building UnrealHeaderTool...
MainFrameActions: Packaging (Windows): UnrealBuildTool: Target is up to date.
MainFrameActions: Packaging (Windows): UnrealBuildTool: Parsing headers for TaskBasedLM
MainFrameActions: Packaging (Windows): UnrealBuildTool: Code generation finished for TaskBasedLM and took 11.498
MainFrameActions: Packaging (Windows): UnrealBuildTool: WARNING: File 'C:\User\Study\animation\code\ue4\Engine\Source\Developer\SourceControl\Private\SourceControlModule.cpp' doesn't use same 'shared' precompiled header as other files in this module: 'CoreUObject.h' vs 'Engine.h'.  This can 
MainFrameActions: Packaging (Windows): greatly impact compile times.  Make sure that your module's private PCH header includes the 'largest' shared PCH header that your module uses
MainFrameActions: Packaging (Windows): UnrealBuildTool: Performing 367 actions (max 4 parallel jobs)
MainFrameActions: Packaging (Windows): UnrealBuildTool: PCH.Shared.Core.h.cpp
MainFrameActions: Packaging (Windows): UnrealBuildTool: PCH.Shared.CoreUObject.h.cpp
MainFrameActions: Packaging (Windows): UnrealBuildTool: PCH.Shared.Engine.h.cpp
MainFrameActions: Packaging (Windows): UnrealBuildTool: PCH.Shared.UnrealEd.h.cpp
MainFrameActions: Packaging (Windows): UnrealBuildTool: C:\User\Study\animation\code\ue4\Engine\Source\Editor\UnrealEd\Public\UnrealEd.h(55) : error C2146: syntax error : missing ';' before identifier 'EditorInit'
MainFrameActions: Packaging (Windows): UnrealBuildTool: C:\User\Study\animation\code\ue4\Engine\Source\Editor\UnrealEd\Public\UnrealEd.h(55) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
MainFrameActions: Packaging (Windows): UnrealBuildTool: C:\User\Study\animation\code\ue4\Engine\Source\Runtime\Core\Public\HAL\Platform.h(529) : error C2378: 'int32' : redefinition; symbol cannot be overloaded with a typedef
MainFrameActions: Packaging (Windows): UnrealBuildTool:         C:\User\Study\animation\code\ue4\Engine\Source\Editor\UnrealEd\Public\UnrealEd.h(55) : see declaration of 'int32'
MainFrameActions: Packaging (Windows): UnrealBuildTool: C:\User\Study\animation\code\ue4\Engine\Source\Runtime\Core\Public\HAL\Platform.h(581) : error C2064: term does not evaluate to a function taking 1 arguments
MainFrameActions: Packaging (Windows): UnrealBuildTool: C:\User\Study\animation\code\ue4\Engine\Source\Runtime\Core\Public\HAL\Platform.h(584) : error C2064: term does not evaluate to a function taking 1 arguments
MainFrameActions: Packaging (Windows): UnrealBuildTool: C:\User\Study\animation\code\ue4\Engine\Source\Runtime\Core\Public\HAL\Platform.h(594) : error C2064: term does not evaluate to a function taking 1 arguments
MainFrameActions: Packaging (Windows): UnrealBuildTool: C:\User\Study\animation\code\ue4\Engine\Source\Runtime\Core\Public\HAL\Platform.h(597) : error C2064: term does not evaluate to a function taking 1 arguments
MainFrameActions: Packaging (Windows): UnrealBuildTool: C:\User\Study\animation\code\ue4\Engine\Source\Runtime\Core\Public\HAL\Platform.h(600) : error C2064: term does not evaluate to a function taking 1 arguments
MainFrameActions: Packaging (Windows): UnrealBuildTool: C:\User\Study\animation\code\ue4\Engine\Source\Runtime\Core\Public\HAL\Platform.h(600) : error C2338: TypeTests_INT_sign
MainFrameActions: Packaging (Windows): UnrealBuildTool: C:\User\Study\animation\code\ue4\Engine\Source\Runtime\Core\Public\HAL\Platform.h(606) : error C2064: term does not evaluate to a function taking 1 arguments
MainFrameActions: Packaging (Windows): UnrealBuildTool: C:\User\Study\animation\code\ue4\Engine\Source\Runtime\Core\Public\Misc\Timespan.h(82) : error C2061: syntax error : identifier 'int32'
MainFrameActions: Packaging (Windows): UnrealBuildTool: C:\User\Study\animation\code\ue4\Engine\Source\Runtime\Core\Public\Misc\Timespan.h(82) : error C2535: 'FTimespan::FTimespan(void)' : member function already defined or declared

How come the engine fails to compile here ?

Many thanks.

Cheers,

darkZ

I haven’t tried it again yet… Will give it some time soon. I gave up on it until I find some new information on it.

Hey DarkZ,

Could you get it to work?

This situation takes place, if you add UnrealEd to your *.Build.cs and build the project with the configurations without the editor (f.e. “Development” instead of “Developnment Editor”). Macro WITH_EDITOR = 0 with such configurations. Look at UnrealEd.h. When WITH_EDITOR == 0, the part of the file with many #include doesn’t get into the build. Thus, the first error “missing ‘;’ before identifier ‘EditorInit’” occurs. The type int32 is unknown as it is defined in the header file which doesn’t get into the build because of the macro. Other errors happen according to the same scenario.

Ah that seems like a great answer. I will try it out and get back to you. Thanks !

Would I define WITH_EDITOR in my Game.h file ?

I think this is not a corrent decision. WITH_EDITOR is defined by UBT. Look at …\Engine\Source\Programs\UnrealBuildTool\Configuration\UEBuildTarget.cs. I also think that you don’t need UnrealEd for configurations without the editor. It doesn’t make any sense. Add it optionally in your *.Build.cs for configurations with the editor

I checked and I don’t have UnrealEd in my build.cs. file So I think the issue is also that I need to build my project in Development mode. Howevever I get the following error as its not able to find the symbol UNREALED_API

1> Module.Engine.16_of_41.cpp
1>C:\User\study\animation\code\UnrealEngine4.2\Engine\Source\Editor\UnrealEd\Public\UnrealEd.h(54): error C2146: syntax error : missing ‘;’ before identifier ‘EditorInit’

It seems that a certain file includes UnrealEd.h. The scenario with WITH_EDITOR == 0 happens for configurations without the editor. That is why such things as UNREALED_API, int32 etc are not defined.

public TaskBasedLM(TargetInfo Target)
{

        MinFilesUsingPrecompiledHeaderOverride = 1;
        bFasterWithoutUnity = true;

		PublicDependencyModuleNames.AddRange(new string[] { 
            "Core", 
            "CoreUObject", 
         //   "Engine", 
          //  "EditorStyle",
            "Slate",
			"SlateCore",
            "InputCore", 
         //   "PropertyEditor",
			"BlueprintGraph",
            "AnimGraph" });

        PrivateDependencyModuleNames.AddRange(new string[] { 
        //        "PropertyEditor"
        });
        
        PrivateIncludePathModuleNames.AddRange(
            new string[] {
		//	"PropertyEditor",
          //  "EditorStyle"
			}
        );

        DynamicallyLoadedModuleNames.AddRange(
            new string[] {
			//	"PropertyEditor"
			}
        );

		
		MinFilesUsingPrecompiledHeaderOverride = 1;
		bFasterWithoutUnity = true;

		// Uncomment if you are using Slate UI
		// PrivateDependencyModuleNames.Add("Slate");
		
		// Uncomment if you are using online features
		// PrivateDependencyModuleNames.Add("OnlineSubsystem");
		// if ((Target.Platform == UnrealTargetPlatform.Win32) || (Target.Platform == UnrealTargetPlatform.Win64))
		// {
		//		if (UEBuildConfiguration.bCompileSteamOSS == true)
		//		{
		//			DynamicallyLoadedModuleNames.Add("OnlineSubsystemSteam");
		//		}
		// }

        LoadANNLibrary(Target);
	}

This is what my build.cs. looks like. I have commented a bunch of modules with the hope to find the one which is including UnrealEd.h My project does not include UnrealEd.h anywhere though

I have discovered that a precompiled header for UnrealEd comes into play as soon as I include AnimGraph module … And then I get a bunch of errors. AnimGraph depends on UnrealEd, so that explains it. However I need AnimGraph as I implement a custom AnimGraphNode in my project.

I wonder if its possible to exclude certain classes depending on the build type because there’s really no need to build an AnimGraphNode for a packaged project.

You need to make another module. Look at answer:

This fixed all my problems. I can now compile to both the editor target and package my game as well. I had to cook my content through the editor first. Today I learnt a lot of new things about the build setup. Thanks for your time and patience.