Unable to Package UE5.0.3 project with Cesium v1.19.0

Hi,

I have the following issue when I’m trying to package a default UE5 project for Windows platform using CesiumUnreal 1.19.0:

UATHelper: Packaging (Windows): [1/5] Compile Cesium3DTilesetAuthoring.gen.cpp
UATHelper: Packaging (Windows): C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um\winnt.h(603): warning C4005: 'TEXT': macro redefinition
UATHelper: Packaging (Windows): C:\UE\UE_5.0.3\Engine\Source\Runtime\Core\Public\HAL\Platform.h(1171): note: see previous definition of 'TEXT'
UATHelper: Packaging (Windows): C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um\winioctl.h(10277): error C4668: '_WIN32_WINNT_WIN10_RS4' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif'
UATHelper: Packaging (Windows): C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um\winioctl.h(10283): error C4668: '_WIN32_WINNT_WIN10_RS4' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif'
UATHelper: Packaging (Windows): C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um\winioctl.h(10291): error C4668: '_WIN32_WINNT_WIN10_RS5' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif'
UATHelper: Packaging (Windows): C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um\winioctl.h(10510): error C4668: '_WIN32_WINNT_WIN10_RS5' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif'
UATHelper: Packaging (Windows): C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um\winioctl.h(13950): error C4668: '_WIN32_WINNT_WIN10_RS5' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif'
UATHelper: Packaging (Windows): C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um\winioctl.h(15416): error C4668: '_WIN32_WINNT_WIN10_RS4' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif'
UATHelper: Packaging (Windows): C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um\winioctl.h(15429): error C4668: '_WIN32_WINNT_WIN10_RS4' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif'
UATHelper: Packaging (Windows): C:\UE\CesiumReccup\Plugins\CesiumForUnreal-500-v1.19.0-ue5\CesiumForUnreal\Source\ThirdParty\include\CesiumGltf\Material.h(26): error C2059: syntax error: 'constant'
UATHelper: Packaging (Windows): C:\UE\CesiumReccup\Plugins\CesiumForUnreal-500-v1.19.0-ue5\CesiumForUnreal\Source\ThirdParty\include\CesiumGltf\Material.h(26): error C2238: unexpected token(s) preceding ';'
UATHelper: Packaging (Windows): C:\UE\CesiumReccup\Plugins\CesiumForUnreal-500-v1.19.0-ue5\CesiumForUnreal\Source\ThirdParty\include\CesiumGltf\Material.h(92): error C2589: 'constant': illegal token on right side of '::'
UATHelper: Packaging (Windows): C:\UE\CesiumReccup\Plugins\CesiumForUnreal-500-v1.19.0-ue5\CesiumForUnreal\Source\ThirdParty\include\CesiumGltf\Material.h(92): error C2062: type 'unknown-type' unexpected
UATHelper: Packaging (Windows): C:\UE\CesiumReccup\Plugins\CesiumForUnreal-500-v1.19.0-ue5\CesiumForUnreal\Source\CesiumRuntime\Public\CesiumCreditSystem.h(5): fatal error C1083: Cannot open include file: 'Components/WidgetComponent.h': No such file or directory
PackagingResults: Error: 'constant'
UATHelper: Packaging (Windows): [2/5] Compile Cesium3DTilesetAuthoring.cpp
UATHelper: Packaging (Windows): C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um\winnt.h(603): warning C4005: 'TEXT': macro redefinition
UATHelper: Packaging (Windows): C:\UE\UE_5.0.3\Engine\Source\Runtime\Core\Public\HAL\Platform.h(1171): note: see previous definition of 'TEXT'
UATHelper: Packaging (Windows): C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um\winioctl.h(10277): error C4668: '_WIN32_WINNT_WIN10_RS4' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif'
UATHelper: Packaging (Windows): C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um\winioctl.h(10283): error C4668: '_WIN32_WINNT_WIN10_RS4' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif'
UATHelper: Packaging (Windows): C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um\winioctl.h(10291): error C4668: '_WIN32_WINNT_WIN10_RS5' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif'
UATHelper: Packaging (Windows): C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um\winioctl.h(10510): error C4668: '_WIN32_WINNT_WIN10_RS5' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif'
UATHelper: Packaging (Windows): C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um\winioctl.h(13950): error C4668: '_WIN32_WINNT_WIN10_RS5' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif'
UATHelper: Packaging (Windows): C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um\winioctl.h(15416): error C4668: '_WIN32_WINNT_WIN10_RS4' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif'
UATHelper: Packaging (Windows): C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um\winioctl.h(15429): error C4668: '_WIN32_WINNT_WIN10_RS4' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif'
UATHelper: Packaging (Windows): C:\UE\CesiumReccup\Plugins\CesiumForUnreal-500-v1.19.0-ue5\CesiumForUnreal\Source\ThirdParty\include\CesiumGltf\Material.h(26): error C2059: syntax error: 'constant'
UATHelper: Packaging (Windows): C:\UE\CesiumReccup\Plugins\CesiumForUnreal-500-v1.19.0-ue5\CesiumForUnreal\Source\ThirdParty\include\CesiumGltf\Material.h(26): error C2238: unexpected token(s) preceding ';'
UATHelper: Packaging (Windows): C:\UE\CesiumReccup\Plugins\CesiumForUnreal-500-v1.19.0-ue5\CesiumForUnreal\Source\ThirdParty\include\CesiumGltf\Material.h(92): error C2589: 'constant': illegal token on right side of '::'
UATHelper: Packaging (Windows): C:\UE\CesiumReccup\Plugins\CesiumForUnreal-500-v1.19.0-ue5\CesiumForUnreal\Source\ThirdParty\include\CesiumGltf\Material.h(92): error C2062: type 'unknown-type' unexpected
UATHelper: Packaging (Windows): C:\UE\CesiumReccup\Plugins\CesiumForUnreal-500-v1.19.0-ue5\CesiumForUnreal\Source\CesiumRuntime\Public\CesiumCreditSystem.h(5): fatal error C1083: Cannot open include file: 'Components/WidgetComponent.h': No such file or directory
PackagingResults: Error: 'constant'

I tried from sources and from the packaged version available on the Github repo.

Does anyone have an idea ?

Thanks!

Kind regards

I just also wanted to chime in that when i upgrade the cesium plugin from v1.17.0 to v1.18 or v1.19 i’m unable to build and open my project for unreal editor source version 5.0.3.

Also, is the plugin ready to be used with v5.1.0?

Hi,did you resolve it? I encountered the same situation. :cold_sweat:

Cesium for Unreal v1.20.1 is now available from the Epic Marketplace for both UE 5.0 and UE 5.1. If you’re having trouble with that version, please report the exact steps you’re following and what problems you see, so that we can try to reproduce the problem. We’re not aware of any problems packaging on Windows in either UE5.0 or 5.1.

Thanks a lot. I get the Plugin from github using UE 4.26 & CesiumUnreal 1.20.0. If i just include the plugin and do nothing ,it works normal (Package),but if i use #include “Cesium3DTileset.h” in my c++ class ,it can complie successful in VS2019 but package failed ,the log message is same like above.

Two things I can think of:

  1. If you’re including a Cesium header file, your project must be configured to use C++17 in your .build.cs file.
  2. Is your code including windows.h or another Windows header file? Windows loves to #define common symbols, cause all kinds of strange compile errors. It’s best to keep code that uses Windows header files directly separate from the compilation of Unreal and its plugins.

Kevin

Thank you for your patience!
1.I configured to use C++ 17 in my project.build.cs,like that

// Copyright Epic Games, Inc. All Rights Reserved.

using UnrealBuildTool;

public class TestPackProject : ModuleRules
{
    public TestPackProject(ReadOnlyTargetRules Target) : base(Target)
    {
        PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;

        PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore", "CesiumRuntime" });

        PrivateDependencyModuleNames.AddRange(new string[] { });

        CppStandard = CppStandardVersion.Cpp17;
        // Uncomment if you are using Slate UI
        // PrivateDependencyModuleNames.AddRange(new string[] { "Slate", "SlateCore" });

        // Uncomment if you are using online features
        // PrivateDependencyModuleNames.Add("OnlineSubsystem");

        // To include OnlineSubsystemSteam, add it to the plugins section in your uproject file with the Enabled attribute set to true
    }
}
  1. I just use #include xxx as normal in UE , that’s my simple code
#pragma once

#include "CoreMinimal.h"
#include "GameFramework/Actor.h"
#include "Cesium3DTileset.h"
#include "CustomActor.generated.h"

UCLASS()
class TESTPACKPROJECT_API ACustomActor : public AActor
{
	GENERATED_BODY()

public:
	// Sets default values for this actor's properties
	ACustomActor();

protected:
	// Called when the game starts or when spawned
	virtual void BeginPlay() override;

public:
	// Called every frame
	virtual void Tick(float DeltaTime) override;

	UPROPERTY(EditAnywhere, Category = "TestCagory")
		ACesium3DTileset* BTerrain;

};

I tried to UTF-8 ,but it work wrong also.

Do you have any source files that #include <windows.h> or similar? Because Unity’s build process globs all the source files together, it doesn’t matter that only this one is including Cesium3DTileset.h.

If that’s not the problem, can you provide a minimal project that reproduces the problem so that we can take a look?

TestPackProject.zip (1.7 MB)
Because of the file size limit , i did not upload the plugin. It’s minimal project . Thank you very much.

Thanks for the project. I’m not easily able to try packaging it, though, because I don’t have the necessary Visual Studio version for UE 4.26. UE 4.26 will no longer be receiving any Cesium for Unreal updates, though, so can I ask why you’re using that version?

Also, you mentioned that you didn’t include the plugin. Why is the plugin embedded in your project directory, rather than installed as an engine plugin via the Epic Launcher? We don’t typically test packaging when the plugin is embedded in the project because that’s an unusual use-case.

Kevin

hi,I download the version 1.20.1 from github just now and not embeded in my new project directory ( just use UE Plugin ),but the same thing happens, I configured to use C++ 17 and included in project in .build.cs like above.
Because this topic man use UE5.0.3 and similar error occurs ,I doubt it regardless of UE version.

UATHelper: Packaging (Windows (64-bit)):     [8/11] TestActor.cpp
UATHelper: Packaging (Windows (64-bit)):     C:\Program Files (x86)\Windows Kits\10\include\10.0.20348.0\um\winnt.h(610): warning C4005: 'TEXT': macro redefinition
UATHelper: Packaging (Windows (64-bit)):     D:\Program Files\Epic Games\UE_4.26\Engine\Source\Runtime\Core\Public\HAL/Platform.h(1082): note: see previous definition of 'TEXT'
UATHelper: Packaging (Windows (64-bit)):     D:\Program Files\Epic Games\UE_4.26\Engine\Plugins\Marketplace\CesiumForUnreal\Source\ThirdParty\include\CesiumGltf/Material.h(26): error C2059: syntax error: 'constant'
UATHelper: Packaging (Windows (64-bit)):     D:\Program Files\Epic Games\UE_4.26\Engine\Plugins\Marketplace\CesiumForUnreal\Source\ThirdParty\include\CesiumGltf/Material.h(26): error C2238: unexpected token(s) preceding ';'
UATHelper: Packaging (Windows (64-bit)):     D:\Program Files\Epic Games\UE_4.26\Engine\Plugins\Marketplace\CesiumForUnreal\Source\ThirdParty\include\CesiumGltf/Material.h(92): error C2589: 'constant': illegal token on right side of '::'
UATHelper: Packaging (Windows (64-bit)):     D:\Program Files\Epic Games\UE_4.26\Engine\Plugins\Marketplace\CesiumForUnreal\Source\ThirdParty\include\CesiumGltf/Material.h(92): error C2062: type 'unknown-type' unexpected
UATHelper: Packaging (Windows (64-bit)):     D:\Program Files\Epic Games\UE_4.26\Engine\Plugins\Marketplace\CesiumForUnreal\Source\CesiumRuntime\Public\CesiumCreditSystem.h(5): fatal error C1083: Cannot open include file: 'Components/WidgetComponent.h': No such file or directory
PackagingResults: Error: 'constant'
UATHelper: Packaging (Windows (64-bit)):     [9/11] TestActor.gen.cpp
UATHelper: Packaging (Windows (64-bit)):     C:\Program Files (x86)\Windows Kits\10\include\10.0.20348.0\um\winnt.h(610): warning C4005: 'TEXT': macro redefinition
UATHelper: Packaging (Windows (64-bit)):     D:\Program Files\Epic Games\UE_4.26\Engine\Source\Runtime\Core\Public\HAL/Platform.h(1082): note: see previous definition of 'TEXT'
UATHelper: Packaging (Windows (64-bit)):     D:\Program Files\Epic Games\UE_4.26\Engine\Plugins\Marketplace\CesiumForUnreal\Source\ThirdParty\include\CesiumGltf/Material.h(26): error C2059: syntax error: 'constant'
UATHelper: Packaging (Windows (64-bit)):     D:\Program Files\Epic Games\UE_4.26\Engine\Plugins\Marketplace\CesiumForUnreal\Source\ThirdParty\include\CesiumGltf/Material.h(26): error C2238: unexpected token(s) preceding ';'
UATHelper: Packaging (Windows (64-bit)):     D:\Program Files\Epic Games\UE_4.26\Engine\Plugins\Marketplace\CesiumForUnreal\Source\ThirdParty\include\CesiumGltf/Material.h(92): error C2589: 'constant': illegal token on right side of '::'
UATHelper: Packaging (Windows (64-bit)):     D:\Program Files\Epic Games\UE_4.26\Engine\Plugins\Marketplace\CesiumForUnreal\Source\ThirdParty\include\CesiumGltf/Material.h(92): error C2062: type 'unknown-type' unexpected
UATHelper: Packaging (Windows (64-bit)):     D:\Program Files\Epic Games\UE_4.26\Engine\Plugins\Marketplace\CesiumForUnreal\Source\CesiumRuntime\Public\CesiumCreditSystem.h(5): fatal error C1083: Cannot open include file: 'Components/WidgetComponent.h': No such file or directory
PackagingResults: Error: 'constant'

hi,Kevin.
Thanks for your reply.
This time i use UE5.0.3 to work, downloaded the version 1.20.1 from github and not embeded in my new project directory ( just use UE Plugin ). I just create a simple actor and add a ACesium3DTileset property as attachment pic shows , but the same thing happens, I configured to use C++ 17 and included in project in .build.cs .The attachement are the error logs and source snapshot . can you help me?
Look for you reply.thanks again!

Jedi

Thanks, I can reproduce this problem now. I’m investigating, and will let you know what I learn.

Hi,

I solved the problem in my case.
Used this :

#include “windows/WindowsWindow.h”
#undef OPAQUE
#include “Cesium3DTileset.h”

The #undef is not very clean…
A better solution in cesium code would be nice :wink:

hi,blochet!
It remain worked unnormal.

jedijin,

I fixed those include errors on our project by adding “UMG” in the PublicDependencyModuleNames found in the ProjectName.Build.cs file.

@nathm it works fine by add “UMG” ! :smile: Thank you very much ! Thanks blochet too!
it would be nice to have a solution in cesium code.

Hi folks,

I did some digging into this. Long story short, if you want to #include Cesium for Unreal headers in your own source files, you need to make sure those source files are built with these options (add them to your .Build.cs file):

PublicDependencyModuleNames.AddRange(new string[] { "CesiumRuntime", "UMG" });
CppStandard = CppStandardVersion.Cpp17;
bEnableExceptions = true;

Here’s the explanation for each of these lines:

PublicDependencyModuleNames.AddRange(new string[] { "CesiumRuntime", "UMG" });

It’s hopefully unsurprising that you need to depend on the CesiumRuntime module, since you’re trying to use its functionality. UMG is more unexpected, though. It is required because Cesium for Unreal #includes UMG from its public headers, but only declares it as a private dependency, not a public one, so its not inherited by things that depend on Cesium for Unreal.

I’ve opened a pull request to fix this, so UMG should not be required anymore in future versions (but it won’t do any harm):

CppStandard = CppStandardVersion.Cpp17;

Cesium for Unreal uses C++ 17, so there’s no way to use our header files in your source files without compiling your source files for C++ 17.

bEnableExceptions = true;

This is necessary because of a questionable choice in a third-party library used by Cesium for Unreal. On Windows, when exceptions are disabled, it does a #include <windows.h>. Including windows.h in an Unreal project is disastrous, and causes all kinds of strange compiler errors. I don’t have a fix for this one yet, but enabling exceptions in your project is an effective workaround.

Kevin

2 Likes

Right on… I just came across this issue myself… It was odd because out of nowhere I started to see this issue. Had been packaging up fine, but all of a sudden stopped working. I found that I needed to take the Cesium reference out of the PrivateDependencyModuleNames and put it into the PublicDependencyModuleNames.