# Comments are causing my compile to fail !? help.

**URL:** <https://forums.unrealengine.com/t/comments-are-causing-my-compile-to-fail-help/741197>\
**Category:** Programming & Scripting\
**Tags:** error, compiling, unreal-engine, compile, question\
**Created:** [January 3, 2023, 2:20pm UTC](https://forums.unrealengine.com/t/comments-are-causing-my-compile-to-fail-help/741197 "2023-01-03T14:20:54Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![somawheels](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@somawheels](https://forums.unrealengine.com/u/somawheels)\
**Post date:** [January 3, 2023, 2:20pm UTC](https://forums.unrealengine.com/t/comments-are-causing-my-compile-to-fail-help/741197/1 "2023-01-03T14:20:54Z")

</div>

I suddenly started getting “unresolved external symbol” errors.  
I found the function causing this, but i dont understand why its causing the errors.

This is the function

```auto
void UModelData_RSClass::encode_or_decode_Format_2(bool encode, UMod* Mod, UBuffer_RSClass* byteBuffer)
{
	isDefaulted = false;

	if (encode) {
		/*uint8 propertyCodeEncode = 0;
		PropertyMetadata.KeySort([](int32 A, int32 B) { return A < B; });
		for (const TPair<uint8, FPropertyMetadata>& pair : PropertyMetadata)
		{
			propertyCodeEncode = pair.Key;
			if (PropertyMetadata.FindRef(propertyCodeEncode).OverrideModes_Mods.Contains(Mod)) { //if The Mod contains this propertyCode
				byteBuffer->writeByte(propertyCodeEncode);
				switch (propertyCodeEncode)
				{
					case 2:
						byteBuffer->writeLong(parent_id);
						break;
					case 3:
						byteBuffer->writeStringCp1252NullTerminated(name);
						break;
						//End_Object_Base
					case 11:
						byteBuffer->writeVector_16_Array(vertexPositions, 10);
						break;
					case 12:
						byteBuffer->writeInt_Array(faceIndices1);
						break;
					case 13:
						byteBuffer->writeInt_Array(faceIndices2);
						break;
					case 14:
						byteBuffer->writeInt_Array(faceIndices3);
						break;
					case 15:
						byteBuffer->writeByte_Array(face_material_index);
						break;
					case 16:
						byteBuffer->writeLong_Array(material_ids);
						break;
					case 17:
						byteBuffer->writeInt_Array(faceColors);
						break;
					case 18:
						byteBuffer->writeVector_16_Array(vertexNormals, 1000);
						break;
					case 19:
						{
							byteBuffer->writeShort(faceTextureUCoordinates.Num());
							for (int i0 = 0; i0 < faceTextureUCoordinates.Num(); i0++)
							{
								byteBuffer->writeFloat_16(faceTextureUCoordinates[i0].arr[0], 2048);
								byteBuffer->writeFloat_16(faceTextureUCoordinates[i0].arr[1], 2048);
								byteBuffer->writeFloat_16(faceTextureUCoordinates[i0].arr[2], 2048);
							
								byteBuffer->writeFloat_16(faceTextureVCoordinates[i0].arr[0], 2048);
								byteBuffer->writeFloat_16(faceTextureVCoordinates[i0].arr[1], 2048);
								byteBuffer->writeFloat_16(faceTextureVCoordinates[i0].arr[2], 2048);
							}
						}
						break;
					case 20:
						byteBuffer->writeByte_Array(faceTransparencies);
						break;
					case 21:
						byteBuffer->writeByte_Array(faceRoughness);
						break;
					case 22:
						byteBuffer->writeByte_Array(faceMetallic);
						break;
				}
			}
		}*/
	}
	else
	{
		uint8 propertyCode = 0;
		while (byteBuffer->offset < (byteBuffer->array.Num())) {
			propertyCode = byteBuffer->readByte();
			AddPropertyOverride(propertyCode, Mod);
			switch (propertyCode)
			{
				case 2:
					byteBuffer->readLong(parent_id);
					break;
				case 3:
					byteBuffer->readStringCp1252NullTerminated(name);
					break;
				case 4:
					{
						int64 idTemp = id;
						Recycle();
						id = idTemp;
					}
					break;
				case 11:
					byteBuffer->readVector_16_Array(vertexPositions, 10);
					break;
				case 12:
					byteBuffer->readInt_Array(faceIndices1);
					break;
				case 13:
					byteBuffer->readInt_Array(faceIndices2);
					break;
				case 14:
					byteBuffer->readInt_Array(faceIndices3);
					break;
				case 15:
					byteBuffer->readByte_Array(face_material_index);
					break;
				case 16:
					byteBuffer->readLong_Array(material_ids);
					break;
				case 17:
					byteBuffer->readInt_Array(faceColors);
					break;
				case 18:
					byteBuffer->readVector_16_Array(vertexNormals, 1000);
					break;
				case 19:
					{
						faceCount = byteBuffer->readShort();
						F2DArrayElement_Float faceUV_elem; faceUV_elem.arr.Init(0,3);
						faceTextureUCoordinates.Init(faceUV_elem,faceCount);
						faceTextureVCoordinates.Init(faceUV_elem,faceCount);
						for (int i0 = 0; i0 < faceCount; i0++)
						{
							byteBuffer->readFloat_16(faceTextureUCoordinates[i0].arr[0], 2048);
							byteBuffer->readFloat_16(faceTextureUCoordinates[i0].arr[1], 2048);
							byteBuffer->readFloat_16(faceTextureUCoordinates[i0].arr[2], 2048);
							
							byteBuffer->readFloat_16(faceTextureVCoordinates[i0].arr[0], 2048);
							byteBuffer->readFloat_16(faceTextureVCoordinates[i0].arr[1], 2048);
							byteBuffer->readFloat_16(faceTextureVCoordinates[i0].arr[2], 2048);
						}
					}
					break;
				case 20:
					byteBuffer->readByte_Array(faceTransparencies);
					break;
				case 21:
					byteBuffer->readByte_Array(faceRoughness);
					break;
				case 22:
					byteBuffer->readByte_Array(faceMetallic);
					break;
			}
		}
	}
}

```

If I simply remove the commented text between the /\* and \*/, the errors disappear.  
Why could this be?

I am using Rider and UE4.27.

---

<div class="post-metadata">

**Author:** ![somawheels](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@somawheels](https://forums.unrealengine.com/u/somawheels)\
**Post date:** [January 3, 2023, 5:11pm UTC](https://forums.unrealengine.com/t/comments-are-causing-my-compile-to-fail-help/741197/2 "2023-01-03T17:11:15Z")

</div>

this case is causing some sort of problem.

```auto
				case 19:
					{
						byteBuffer->writeShort(faceTextureUCoordinates.Num());
						for (i0 = 0; i0 < faceTextureUCoordinates.Num(); i0++)
						{
							byteBuffer->writeFloat_16(faceTextureUCoordinates[i0].arr[0], 2048);
							byteBuffer->writeFloat_16(faceTextureUCoordinates[i0].arr[1], 2048);
							byteBuffer->writeFloat_16(faceTextureUCoordinates[i0].arr[2], 2048);
						
							byteBuffer->writeFloat_16(faceTextureVCoordinates[i0].arr[0], 2048);
							byteBuffer->writeFloat_16(faceTextureVCoordinates[i0].arr[1], 2048);
							byteBuffer->writeFloat_16(faceTextureVCoordinates[i0].arr[2], 2048);
						}
						break;
					}

```

this fails to compile.  
However if i remove a couple of lines like this, it compiles

```auto
				case 19:
					{
						byteBuffer->writeShort(faceTextureUCoordinates.Num());
						for (i0 = 0; i0 < faceTextureUCoordinates.Num(); i0++)
						{
							byteBuffer->writeFloat_16(faceTextureUCoordinates[i0].arr[0], 2048);
							byteBuffer->writeFloat_16(faceTextureUCoordinates[i0].arr[1], 2048);
						
							byteBuffer->writeFloat_16(faceTextureVCoordinates[i0].arr[0], 2048);
							byteBuffer->writeFloat_16(faceTextureVCoordinates[i0].arr[1], 2048);
						}
						break;
					}

```

---

<div class="post-metadata">

**Author:** ![somawheels](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@somawheels](https://forums.unrealengine.com/u/somawheels)\
**Post date:** [January 3, 2023, 9:02pm UTC](https://forums.unrealengine.com/t/comments-are-causing-my-compile-to-fail-help/741197/3 "2023-01-03T21:02:59Z")

</div>

I think this is a bug with ue4’s structs.  
If I try to reference an array inside a struct, more than twice within a switch case, I get compile errors.

---

<div class="post-metadata">

**Author:** ![Roy\_Wierer.Seda145](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/roy_wierer.seda145/32/906551_2.png) [@Roy\_Wierer.Seda145](https://forums.unrealengine.com/u/Roy_Wierer.Seda145)\
**Post date:** [January 3, 2023, 9:18pm UTC](https://forums.unrealengine.com/t/comments-are-causing-my-compile-to-fail-help/741197/4 "2023-01-03T21:18:32Z")

</div>

> [@somawheels](#):
>
> “unresolved external symbol”

This error always means that you are using a datatype without including its header. Sometimes your project will just compile until at some point Visual Studio will “notice”.

If you google the name of unreal’s struct you will find a page like this as (probably) the first link:

> [FVector | Unreal Engine Documentation](https://docs.unrealengine.com/4.27/en-US/API/Runtime/Core/Math/FVector/)

There you can see the include you need to add to the file your code lives in.

Also most of Unreal’s basic types are included through the CoreMinimal.h header, which is advised to add to every .h file by default.

To avoid this error popping up at any later moment you can check if your includes are correct for your module by modifying the Build.cs file and recompiling it, then most likely you will see a lot more of this same error right now:

```auto
public class SomeModule: ModuleRules {
	public SomeModule(ReadOnlyTargetRules Target) : base(Target) {
		// To test if all headers are included properly, disable unity, disable PCH, enforce IWYU.
		PCHUsage = PCHUsageMode.NoSharedPCHs;
		bEnforceIWYU = true;
		bUseUnity = false;

//// Any includes

	}
}

```

---

<div class="post-metadata">

**Author:** ![somawheels](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@somawheels](https://forums.unrealengine.com/u/somawheels)\
**Post date:** [January 3, 2023, 9:42pm UTC](https://forums.unrealengine.com/t/comments-are-causing-my-compile-to-fail-help/741197/6 "2023-01-03T21:42:21Z")

</div>

Thankyou for you suggestion 🙂

I have tried including coreMinimal and also the structs file where my custom structs are declared. This didn’t make a difference.

I think the “unresolved external symbol” is a knock-on affect. The class where the problem lies cannot be compiled, so classes relying on it come up with the “unresolved external symbol” error.

See my second comment in this thread, how can you explain that with a missing include?

Also if i simply do the same code but not in a switch statement, it compiles.

---

<div class="post-metadata">

**Author:** ![Roy\_Wierer.Seda145](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/roy_wierer.seda145/32/906551_2.png) [@Roy\_Wierer.Seda145](https://forums.unrealengine.com/u/Roy_Wierer.Seda145)\
**Post date:** [January 3, 2023, 9:54pm UTC](https://forums.unrealengine.com/t/comments-are-causing-my-compile-to-fail-help/741197/7 "2023-01-03T21:54:25Z")

</div>

> [@somawheels](#):
>
> The class where the problem lies cannot be compiled

This I think is possible, I have seen something similar before.

What I have not seen before, is code not compiling because of the content of a comment. If the error appears as an Intellisense notification (or Rider?) you can safely ignore it, because the errors are usually nonsense. If the code does not compile at all because of the contents of that comment, or does not compile at all (finish building successfully) simply because you access a struct more than twice, that would be a mystery to me.

---

<div class="post-metadata">

**Author:** ![Roy\_Wierer.Seda145](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/roy_wierer.seda145/32/906551_2.png) [@Roy\_Wierer.Seda145](https://forums.unrealengine.com/u/Roy_Wierer.Seda145)\
**Post date:** [January 3, 2023, 10:07pm UTC](https://forums.unrealengine.com/t/comments-are-causing-my-compile-to-fail-help/741197/8 "2023-01-03T22:07:05Z")

</div>

Triple check the includes, and of vars ones not listed here including types you access through a container:

custom types:  
UMod  
UBuffer\_RSClass  
FPropertyMetadata

unknown types:  
vertexPositions  
vertexNormals  
faceColors  
material\_ids  
face\_material\_index  
faceIndices1  
faceIndices2  
faceIndices3  
F2DArrayElement\_Float  
faceTextureUCoordinates  
faceTextureUCoordinates  
faceTransparencies  
faceRoughness  
faceMetallic

---

<div class="post-metadata">

**Author:** ![somawheels](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@somawheels](https://forums.unrealengine.com/u/somawheels)\
**Post date:** [January 4, 2023, 12:12am UTC](https://forums.unrealengine.com/t/comments-are-causing-my-compile-to-fail-help/741197/9 "2023-01-04T00:12:20Z")

</div>

I don’t think the class with the problematic code requires any new includes to compile the problematic code.

The required includes are all already present and used by code elsewhere in the class.

It is such a strange annoying problem…

for now i have managed to avoid the errors by putting my code in a for loop like this

```auto
							for (int i1 = 0; i1 < 3; i1++)
							{
								byteBuffer->readFloat_16(faceTextureUCoordinates[i0].arr[i1], 2048);
							}

```

instead of

```auto
						byteBuffer->readFloat_16(faceTextureUCoordinates[i0].arr[0], 2048);
						byteBuffer->readFloat_16(faceTextureUCoordinates[i0].arr[1], 2048);
						byteBuffer->readFloat_16(faceTextureUCoordinates[i0].arr[2], 2048);

```

---

<div class="post-metadata">

**Author:** ![Roy\_Wierer.Seda145](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/roy_wierer.seda145/32/906551_2.png) [@Roy\_Wierer.Seda145](https://forums.unrealengine.com/u/Roy_Wierer.Seda145)\
**Post date:** [January 4, 2023, 4:02pm UTC](https://forums.unrealengine.com/t/comments-are-causing-my-compile-to-fail-help/741197/10 "2023-01-04T16:02:03Z")

</div>

Today I had a similar issue keeping me busy for hours. I upgraded from UE4.27 to UE5.1 and building the code would fail on an engine file which could not find a certain header. After confirming that a clean project compiled just fine I had to debug the issue by removing code until the project compiled. It turned out that when one of my plugins referenced a certain engine header, the project would not build. no errors, no warnings, just that the engine itself failed to find one of its headers. The problem was that I had registered the wrong module for that header in my plugin’s Build.cs file because Epic documented the wrong module name in the docs (for UAnimationBlueprintLibrary).
