CesiumGS / cesium-unreal

Bringing the 3D geospatial ecosystem to Unreal Engine
https://cesium.com/platform/cesium-for-unreal/
Apache License 2.0
879 stars 285 forks source link

VS 2022 build error with CesiumTextureUtility.spec.cpp #1434

Closed arbertrary closed 1 month ago

arbertrary commented 1 month ago

I was getting the following build errors when trying to build a new UE 5.3 test project with the Cesium Plugin (downloaded CesiumForUnreal-53-v2.5.0.zip from the github releases page and extracted to Plugins/ folder).

Severity    Code    Description Project File    Line    Suppression State
Error   C2065   'ReadSurfaceCommand': undeclared identifier CesiumTest  <Project Path>\Plugins\CesiumForUnreal-53-v2.5.0\CesiumForUnreal\Source\CesiumRuntime\Private\Tests\CesiumTextureUtility.spec.cpp   392 
Error   C3861   'ENQUEUE_RENDER_COMMAND': identifier not found  CesiumTest  <Project Path>\Plugins\CesiumForUnreal-53-v2.5.0\CesiumForUnreal\Source\CesiumRuntime\Private\Tests\CesiumTextureUtility.spec.cpp   392 
Error   C2065   'ENQUEUE_RENDER_COMMAND': undeclared identifier CesiumTest  <Project Path>\Plugins\CesiumForUnreal-53-v2.5.0\CesiumForUnreal\Source\CesiumRuntime\Private\Tests\CesiumTextureUtility.spec.cpp   392 
Error   C3861   'FlushRenderingCommands': identifier not found  CesiumTest  <Project Path>\Plugins\CesiumForUnreal-53-v2.5.0\CesiumForUnreal\Source\CesiumRuntime\Private\Tests\CesiumTextureUtility.spec.cpp   413 
Error   MSB3073 The command ""C:\Program Files\Epic Games\UE_5.3\Engine\Build\BatchFiles\Build.bat" CesiumTestEditor Win64 Development -Project="<Project Path>\CesiumTest.uproject" -WaitMutex -FromMsBuild" exited with code 6.   CesiumTest  C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.MakeFile.Targets    44  

I'm a complete C++ beginner so I don't feel comfortable creating a pull request, but adding the following includes to CesiumTextureUtility.spec.cpp fixed the errors for me and allowed me to compile the project. These were suggestions by ChatGPT, I haven't checked whether all of them are necessary or only a subset.

#include "Rendering/RenderingCommon.h"
#include "Rendering/SlateRenderer.h"
#include "RenderCommandFence.h"
#include "RendererInterface.h"
#include "RenderGraphUtils.h"
#include "RenderingThread.h"
kring commented 1 month ago

Thanks @arbertrary. Adding those headers makes sense.

glasshandfilms commented 1 month ago

@arbertrary wow I was about to lose my mind :) haha thank you for sharing!

csciguy8 commented 1 month ago

I'll take a look...

csciguy8 commented 1 month ago

Hi @arbertrary , I'm having a problem reproducing these build errors.

Here's my setup:

Steps: 1) I setup two new projects in Unreal, one Blueprints, one C++ 2) Downloaded CesiumForUnreal-53-v2.5.0.zip from the releases page 3) Unzipped it, then copied "CesiumForUnreal" to each project's "Plugins" folder (I had to create this)

Both the blueprints and C++ project just works when opening. I could use the plugin just fine.

I even opened the test C++ project's .sln file and built all the configurations available. All built correctly.

Anything here look much different than what you are doing?

csciguy8 commented 1 month ago

Actually, I take that back, if delete the contents of CesiumForUnreal/Binaries, open the test blueprint project, Unreal will try to build the plugin, then fails with the errors mentioned.

Investigating...