New build errors when invoking UBT -Rocket for a plugin.

Trying to pinpoint some rocket build issues for my plugin, and potentially some elaboration on how a rocket build differs from any of the other build targets in VisualStudio.

In 5.1 this code will build fine, but in 5.2 there are errors during compilation.

error C2065: 'MD_Surface': undeclared identifier

In someclass.cpp I have included the proper header include “MaterialShared.h” and linked privately to the Engine module as stated via the 5.2 docs Here

This code will fail to compile. Compiles fine for all build targets in VS, just not for a -Rocket build.

#if WITH_EDITOR
		UMaterialInterface* UseMaterial = (this->Material != nullptr) ? this->Material : UMaterial::GetDefaultMaterial(EMaterialDomain::MD_Surface);
#else
		UMaterialInterface* UseMaterial = this->Material;
#endif

You may include “MaterialDomain.h”, it worked for me.

@ErielC_y Yes you are correct.

The reason this fails in Rocket builds as opposed to regular builds is because Rocket forces the build to run without using Unity Builds.

By default for me in Visual Studio, unity builds were being used. Essentially Unity Builds cut down on compilation time, but combine different translation units into larger clumps that only get recompiled if something changes. For local develpoment unity builds are fine, but when building lots of cross platform code, non-unity builds are most certainty required to ensure that the code your are referencing has the correct code in the translation unit.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.