Cesium for Unreal v2.7.0 Build Errors

I just upgraded to v2.7.0 from GitHub and I’m getting the following compile errors:

Unreal Engines says the project could not be compiled and wants me to compile manually.
Visual Studio 2022 and JetBrains Rider both show the same errors.

Hi @Thomas_Ward, sorry you’re having trouble with the new release. I’m curious why you need to build the plugin yourself, though. Is it because you’ve included it in your project, rather than as an Engine plugin? Or is it because you’re using a custom-built Unreal Engine?

In any case, as a quick fix, you can probably just add #include "CesiumEllipsoid.h" near the top of CesiumGlobeAnchorComponent.h. Unreal’s compilation model unfortunately makes it really easy for us to miss includes like this. We’re looking at ways to make it less likely in the future.

@Kevin_Ring We copy the plugin into our project for source control reasons.

It is compiling fine now.

Thanks for your help, I really appreciate it.

Bumping this thread because I’m having a similar issue when installing the plugin from the GitHub distribution. Adding #include "CesiumEllipsoid.h" to CesiumGlobeAnchorComponent.h resolved most of the issues, but we’re still getting one below. This is in Unreal 5.3.2.

[1/4] Compile [x64] CesiumGlobeAnchorCustomization.cpp
C:\path\to\project\Plugins\CesiumForUnreal\Source\CesiumEditor\Private\CesiumGlobeAnchorCustomization.cpp(239): error C2664: 'bool IsValid(const UObject *)': cannot convert argument 1 from 'ACesiumGeoreference *' to 'const UObject *'
C:\path\to\project\Plugins\CesiumForUnreal\Source\CesiumEditor\Private\CesiumGlobeAnchorCustomization.cpp(239): note: Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or parenthesized function-style cast
C:\toolchains\unreal\ue-5.3.2-release\Engine\Source\Runtime\CoreUObject\Public\UObject\Object.h(1771): note: see declaration of 'IsValid'
C:\path\to\project\Plugins\CesiumForUnreal\Source\CesiumEditor\Private\CesiumGlobeAnchorCustomization.cpp(239): note: while trying to match the argument list '(ACesiumGeoreference *)'
C:\path\to\project\Plugins\CesiumForUnreal\Source\CesiumEditor\Private\CesiumGlobeAnchorCustomization.cpp(278): error C2664: 'bool IsValid(const UObject *)': cannot convert argument 1 from 'ACesiumGeoreference *' to 'const UObject *'
C:\path\to\project\Plugins\CesiumForUnreal\Source\CesiumEditor\Private\CesiumGlobeAnchorCustomization.cpp(278): note: Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or parenthesized function-style cast
C:\toolchains\unreal\ue-5.3.2-release\Engine\Source\Runtime\CoreUObject\Public\UObject\Object.h(1771): note: see declaration of 'IsValid'
C:\path\to\project\Plugins\CesiumForUnreal\Source\CesiumEditor\Private\CesiumGlobeAnchorCustomization.cpp(278): note: while trying to match the argument list '(ACesiumGeoreference *)'

Any ideas what could be causing this? @Thomas_Ward did you do anything else to get it compiling?

EDIT:
I was able to get it compiling by changing the IsValid() checks on lines 239 and 278 of CesiumGlobeAnchorCustomization.cpp to != nullptr instead. I can’t guarantee this will deliver the exact same behavior, but it is at least adjacent.

e.g.

// original code
if (IsValid(this->GlobeAnchor->ResolveGeoreference())) {
    // ... blah blah
}

// modified code
if (this->GlobeAnchor->ResolveGeoreference() != nullptr) {
    // ... blah blah
}

I can actually see MSVS Intellisense flagging this as well, although it builds fine.

If I put #include "CesiumGeoreference.h" at the top of CesiumGlobeAnchorCustomization.cpp, the squiggles go away.

Another header include order issue I’m guessing.

Pull request created. I’ll verify 5.3.2 builds here.

Putting #include "CesiumGeoreference.h" at the top of CesiumGlobeAnchorCustomization.cpp only fixed the issue on my home machine, but I was still getting errors on my work computer. I’m still not sure why…

Adding the changes from these two pull requests fixed the compile errors on my work machine:

Merge pull request #1471 from CesiumGS/added-ufunction-to-getellipsoid · CesiumGS/cesium-unreal@c007fc7 (github.com)

Add missing include · CesiumGS/cesium-unreal@2a06200 (github.com)

1 Like