cesium-native icon indicating copy to clipboard operation
cesium-native copied to clipboard

CesiumGltfReader.h linking errors

Open proximityeffect opened this issue 1 year ago • 5 comments

When I #include <CesiumGltfReader/GltfReader.h> I get an error about async. I'm not using async at all.

[build] C:\Users\user\Desktop\EZVCPKG\2024.07.12\installed\x64-windows-static-md\include\async++/task.h(477): error C2187: syntax error: '::' was unexpected here [build] C:\Users\user\Desktop\EZVCPKG\2024.07.12\installed\x64-windows-static-md\include\async++/task.h(477): error C2955: 'async::task': use of class template requires template argument list [build] C:\Users\user\Desktop\EZVCPKG\2024.07.12\installed\x64-windows-static-md\include\async++/task.h(236): note: see declaration of 'async::task'

It autocompletes and links fine, I can link others like <CesiumGltfReader/ImageDecoder.h><CesiumGltfReader/Library.h> just fine. I haven't touched the async++/task.h at all its what was built with cmake for cesium-native. Any help would be appreciated.

proximityeffect avatar Nov 15 '24 04:11 proximityeffect

@proximityeffect what version of C++ are you targetting? C++17? C++20? If you're using C++20, you should use the version of cesium-native from this branch: https://github.com/CesiumGS/cesium-native/pull/977

kring avatar Nov 15 '24 09:11 kring

When GltfReader.h is included, it includes Material.h which also reports this error:

04c3b9e6-5126-46c6-b6f4-0e2fff23ecb1 image

I'm using C++17 in a console project, I haven't included any windows headers, but somehow the macro is defined, causing compiler errors.

Tested on v0.41.0.

jqntn avatar Nov 27 '24 15:11 jqntn

Managed to fix this by simply including CesiumGltf/Material.h before CesiumGltfReader/GltfReader.h 🤷‍♂️

jqntn avatar Nov 27 '24 16:11 jqntn

I met this problem too! But I fix this. This macro pollution is due to the header WS2tcpip.h and WinSock2.h. So I just undef OPAQUE and before include WS2tcpip or something ( in my project is httplib.h), i def OPAQUE to 2.

poorwym avatar May 16 '25 04:05 poorwym

Godot Cesium


https://github.com/Battle-Road-Labs/3D-Tiles-For-Godot/issues/84#issuecomment-2885610870

GeorgeS2019 avatar May 16 '25 10:05 GeorgeS2019