# Compile error C4582 when compiling cesium for UE4.27

**URL:** <https://community.cesium.com/t/compile-error-c4582-when-compiling-cesium-for-ue4-27/26932>\
**Category:** Cesium for Unreal\
**Created:** [September 22, 2023, 4:58pm UTC](https://community.cesium.com/t/compile-error-c4582-when-compiling-cesium-for-ue4-27/26932 "2023-09-22T16:58:26Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![structuregreg](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/structuregreg/32/14037_2.png) [@structuregreg](https://community.cesium.com/u/structuregreg)\
**Post date:** [September 22, 2023, 4:58pm UTC](https://community.cesium.com/t/compile-error-c4582-when-compiling-cesium-for-ue4-27/26932/1 "2023-09-22T16:58:26Z")

</div>

I’m getting a bunch of compile errors similar to this one when I try to compile the cesium plugin for UE4.27:

error C4582: ‘std::_Variant\_storage_\<true,CesiumGltf::MetadataArrayView\<int8\_t\>,CesiumGltf::MetadataArrayView\<uint8\_t\>,CesiumGltf::MetadataArrayView\<int16\_t\>,CesiumGltf::MetadataArrayView\<uint16\_t\>,CesiumGltf::MetadataArrayView\<int32\_t\>,CesiumGltf::MetadataArrayView\<uint32\_t\>,CesiumGltf::MetadataArrayView\<int64\_t\>,CesiumGltf::MetadataArrayView\<uint64\_t\>,CesiumGltf::MetadataArrayView,CesiumGltf::MetadataArrayView,CesiumGltf::MetadataArrayView,CesiumGltf::MetadataArrayViewstd::string\_view\>::\_Tail’: constructor is not implicitly called

This warning is treated as an error by Unreal. I tried searching these forums for anyone mentioning this problem but haven’t found anything. More info: I’m building the soucre code from the 'ue4-main" branch.

git clone --recursive [GitHub - CesiumGS/cesium-unreal: Bringing the 3D geospatial ecosystem to Unreal Engine](https://github.com/CesiumGS/cesium-unreal.git) --branch “ue4-main”

How do I resolve this? I tried disabling this error in WindowsPlatformCompilerSetup.h but then I still get some link errors:

46\>CesiumAsyncd.lib(ThreadPool.cpp.obj) : error LNK2019: unresolved external symbol \_\_dyn\_tls\_on\_demand\_init referenced in function "public: \_\_cdecl \<lambda\_add1bab61293464c9cf45edd8d6d3858\>::operator()(void)const " (??R\<lambda\_add1bab61293464c9cf45edd8d6d3858\>@@QEBA@XZ)  
46\>CesiumAsyncd.lib(ThreadPool.cpp.obj) : error LNK2001: unresolved external symbol \_\_tls\_guard  
46\>s2geometryd.lib(s2cell\_id.cc.obj) : error LNK2019: unresolved external symbol \_\_imp\_\_\_std\_init\_once\_begin\_initialize referenced in function “void \_\_cdecl std::call\_once\<class \<lambda\_79ba321403081603635db02b57b3fb8e\> \>(struct std::once\_flag &,class \<lambda\_79ba321403081603635db02b57b3fb8e\> &&)” (??$call\_once@V\<lambda\_79ba321403081603635db02b57b3fb8e\>@@$$V@std@@YAXAEAUonce\_flag@0@$$QEAV\<lambda\_79ba321403081603635db02b57b3fb8e\>@@@Z)  
46\>s2geometryd.lib(s2cell\_id.cc.obj) : error LNK2019: unresolved external symbol \_\_imp\_\_\_std\_init\_once\_complete referenced in function “public: \_\_cdecl std::\_Init\_once\_completer::~\_Init\_once\_completer(void)” (??1\_Init\_once\_completer@std@@QEAA@XZ)

Thanks in advance for any help!

---

<div class="post-metadata">

**Author:** ![joseph.kaile](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/joseph.kaile/32/3476_2.png) [@joseph.kaile](https://community.cesium.com/u/joseph.kaile)\
**Post date:** [September 22, 2023, 7:45pm UTC](https://community.cesium.com/t/compile-error-c4582-when-compiling-cesium-for-ue4-27/26932/2 "2023-09-22T19:45:25Z")

</div>

Hello, those errors look similar to when I build using VS2022 instead of VS2019.

---

<div class="post-metadata">

**Author:** ![structuregreg](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/structuregreg/32/14037_2.png) [@structuregreg](https://community.cesium.com/u/structuregreg)\
**Post date:** [September 22, 2023, 8:27pm UTC](https://community.cesium.com/t/compile-error-c4582-when-compiling-cesium-for-ue4-27/26932/3 "2023-09-22T20:27:56Z")

</div>

Interesting! Do you have to disable the C4582 warning to compile Cesium for Unreal?

I don’t actually have VS2022. Only 2017,2019 and VSCode. I have updated VS2019 to the latest version as of today.

---

<div class="post-metadata">

**Author:** ![joseph.kaile](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/joseph.kaile/32/3476_2.png) [@joseph.kaile](https://community.cesium.com/u/joseph.kaile)\
**Post date:** [September 22, 2023, 8:58pm UTC](https://community.cesium.com/t/compile-error-c4582-when-compiling-cesium-for-ue4-27/26932/4 "2023-09-22T20:58:45Z")

</div>

No, I’ve never disabled any warnings.

Not sure, I would try to somehow compile with an earlier version, maybe 2017? Of course regenerating the solution files via cmake.

---

<div class="post-metadata">

**Author:** ![structuregreg](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/structuregreg/32/14037_2.png) [@structuregreg](https://community.cesium.com/u/structuregreg)\
**Post date:** [September 22, 2023, 9:25pm UTC](https://community.cesium.com/t/compile-error-c4582-when-compiling-cesium-for-ue4-27/26932/5 "2023-09-22T21:25:20Z")

</div>

By any chance are you compiling for Unreal 5? I’m compiling for 4.27 and I see that in the latest Unreal 5 code, they have disabled the warning that I’m getting (C4582)

[https://github.com/EpicGames/UnrealEngine/commit/4f5ae1338338516356436301bc02af1187372b47](https://github.com/EpicGames/UnrealEngine/commit/4f5ae1338338516356436301bc02af1187372b47)

---

<div class="post-metadata">

**Author:** ![joseph.kaile](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/joseph.kaile/32/3476_2.png) [@joseph.kaile](https://community.cesium.com/u/joseph.kaile)\
**Post date:** [September 22, 2023, 9:36pm UTC](https://community.cesium.com/t/compile-error-c4582-when-compiling-cesium-for-ue4-27/26932/6 "2023-09-22T21:36:01Z")

</div>

Yes I’m using Unreal 5.

Here’s a reference to a similar looking error: [Packaging Error (s2geometry.lib)](https://community.cesium.com/t/packaging-error-s2geometry-lib/18869)

---

<div class="post-metadata">

**Author:** ![structuregreg](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/structuregreg/32/14037_2.png) [@structuregreg](https://community.cesium.com/u/structuregreg)\
**Post date:** [September 25, 2023, 3:28pm UTC](https://community.cesium.com/t/compile-error-c4582-when-compiling-cesium-for-ue4-27/26932/7 "2023-09-25T15:28:19Z")

</div>

This link made me think the problem is related to our project somehow getting compiled with visual studio’s v141 tools.

[https://developercommunity.visualstudio.com/t/-dyn-tls-on-demand-init-and-tls-guard-related-weir/1010557](https://developercommunity.visualstudio.com/t/-dyn-tls-on-demand-init-and-tls-guard-related-weir/1010557)

Since Unreal uses a build system that generates your vcxproj file, I looked into our vcxproj files using a text editor and it looks like we’re compiling with v142.

---

<div class="post-metadata">

**Author:** ![structuregreg](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/structuregreg/32/14037_2.png) [@structuregreg](https://community.cesium.com/u/structuregreg)\
**Post date:** [October 2, 2023, 4:01pm UTC](https://community.cesium.com/t/compile-error-c4582-when-compiling-cesium-for-ue4-27/26932/8 "2023-10-02T16:01:21Z")

</div>

I have reproduced the linker errors using a stock install of Unreal 4.27.2, windows, Visual studio 2019.

46\>CesiumAsyncd.lib(ThreadPool.cpp.obj) : error LNK2019: unresolved external symbol \_\_dyn\_tls\_on\_demand\_init referenced in function "public: \_\_cdecl \<lambda\_add1bab61293464c9cf45edd8d6d3858\>::operator()(void)const " (??R\<lambda\_add1bab61293464c9cf45edd8d6d3858\>@@QEBA@XZ)  
46\>CesiumAsyncd.lib(ThreadPool.cpp.obj) : error LNK2001: unresolved external symbol \_\_tls\_guard  
46\>s2geometryd.lib(s2cell\_id.cc.obj) : error LNK2019: unresolved external symbol \_\_imp\_\_\_std\_init\_once\_begin\_initialize referenced in function “void \_\_cdecl std::call\_once\<class \<lambda\_79ba321403081603635db02b57b3fb8e\> \>(struct std::once\_flag &,class \<lambda\_79ba321403081603635db02b57b3fb8e\> &&)” (??$call\_once@V\<lambda\_79ba321403081603635db02b57b3fb8e\>@@$$V@std@@YAXAEAUonce\_flag@0@$$QEAV\<lambda\_79ba321403081603635db02b57b3fb8e\>@@@Z)  
46\>s2geometryd.lib(s2cell\_id.cc.obj) : error LNK2019: unresolved external symbol \_\_imp\_\_\_std\_init\_once\_complete referenced in function “public: \_\_cdecl std::\_Init\_once\_completer::~\_Init\_once\_completer(void)” (??1\_Init\_once\_completer@std@@QEAA@XZ)

---

<div class="post-metadata">

**Author:** ![Kevin\_Ring](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/kevin_ring/32/2003_2.png) [@Kevin\_Ring](https://community.cesium.com/u/Kevin_Ring)\
**Post date:** [October 4, 2023, 12:24am UTC](https://community.cesium.com/t/compile-error-c4582-when-compiling-cesium-for-ue4-27/26932/9 "2023-10-04T00:24:27Z")

</div>

The last version of Cesium for Unreal that supported UE 4.27 was v1.24.0, which was released over 6 months ago. You can download old versions from our releases page if you want to use them without going through the trouble of building them yourself:

> **[Releases · CesiumGS/cesium-unreal](https://github.com/CesiumGS/cesium-unreal/releases)**
>
> Bringing the 3D geospatial ecosystem to Unreal Engine - CesiumGS/cesium-unreal

But a lot has already changed in the plugin in that time, and it’s only going to become more obsolete over time. I think your time would almost certainly be better spent upgrading your project to UE 5.x rather than fighting with the build process of an ancient and unsupported version of Cesium for Unreal.
