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

**URL:** <https://forums.unrealengine.com/t/new-build-errors-when-invoking-ubt-rocket-for-a-plugin/1253622>\
**Category:** C++\
**Tags:** UE-5, win64, unreal-engine, CPP, question\
**Created:** [August 7, 2023, 3:29pm UTC](https://forums.unrealengine.com/t/new-build-errors-when-invoking-ubt-rocket-for-a-plugin/1253622 "2023-08-07T15:29:26Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rumzie](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Rumzie](https://forums.unrealengine.com/u/Rumzie)\
**Post date:** [August 7, 2023, 3:29pm UTC](https://forums.unrealengine.com/t/new-build-errors-when-invoking-ubt-rocket-for-a-plugin/1253622/1 "2023-08-07T15:29:26Z")

</div>

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.

```auto
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](https://docs.unrealengine.com/5.2/en-US/API/Runtime/Engine/EMaterialDomain/)

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

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

```

---

<div class="post-metadata">

**Author:** ![ErielC\_y](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ErielC\_y](https://forums.unrealengine.com/u/ErielC_y)\
**Post date:** [March 29, 2024, 2:58pm UTC](https://forums.unrealengine.com/t/new-build-errors-when-invoking-ubt-rocket-for-a-plugin/1253622/2 "2024-03-29T14:58:42Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Rumzie](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Rumzie](https://forums.unrealengine.com/u/Rumzie)\
**Post date:** [April 18, 2024, 6:16pm UTC](https://forums.unrealengine.com/t/new-build-errors-when-invoking-ubt-rocket-for-a-plugin/1253622/3 "2024-04-18T18:16:21Z")

</div>

@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.

---

<div class="post-metadata">

**Author:** ![system](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/1/3/713c9d3f58553f0de89543d76a8a3a2779dc9fa4.png) [@system](https://forums.unrealengine.com/u/system)\
**Post date:** [May 18, 2024, 6:16pm UTC](https://forums.unrealengine.com/t/new-build-errors-when-invoking-ubt-rocket-for-a-plugin/1253622/4 "2024-05-18T18:16:32Z")

</div>

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