Unresolved Reference FMassFragment

Hi im currently using ue5.0.2 with visual studio 2022. I am trying to follow the mass entity demo but when i try and compile i get hit with an unresolved external symbol error.

error LNK2019: unresolved external symbol “__declspec(dllimport) class UScriptStruct * __cdecl Z_Construct_UScriptStruct_FMassFragment(void)” (_imp?Z_Construct_UScriptStruct_FMassFragment@@YAPEAVUScriptStruct@@anonymous_user_9674a66c) referenced in function “void __cdecl `dynamic initializer for ‘public: static struct UECodeGen_Private::FStructParams const Z_Construct_UScriptStruct_FSimpleMovementFragment_Statics::ReturnStructParams’’(void)” (??__E?ReturnStructParams@Z_Construct_UScriptStruct_FSimpleMovementFragment_Statics@@2UFStructParams@UECodeGen_Private@@anonymous_user_31e84eb0@@YAXXZ)

This is all i have in my class

#include “CoreMinimal.h”
#include “MassEntityTraitBase.h”
#include “MassEntityTypes.h”
#include “Cone_Traits.generated.h”

USTRUCT()
struct FSimpleMovementFragment : public FMassFragment
{
GENERATED_BODY()
FVector Target;
};

UCLASS()
class UCone_Traits : public UMassEntityTraitBase
{
GENERATED_BODY()

protected:
//virtual void BuildTemplate(FMassEntityTemplateBuildContext& BuildContext, UWorld& World) const override;
};

Please help

2 Likes

I’m not sure if it’s related, but shouldn’t your classes be annotated with XXX_API ? That marks them for dynamic linking.

1 Like

Here’s a *.Build.cs for using Mass Entity, Mass Gameplay, and Mass AI

using UnrealBuildTool;

public class MassEntityTest : ModuleRules
{
	public MassEntityTest(ReadOnlyTargetRules Target) : base(Target)
	{
		PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;

		PublicDependencyModuleNames.AddRange(new string[] {
			"Core",
			"CoreUObject",
			"Engine",
			"InputCore",
            "StateTreeModule",
            "StructUtils",
		});

		PrivateDependencyModuleNames.AddRange(new string[] {
			// AI/MassAI Plugin Modules
			"MassAIBehavior",
			"MassAIDebug",

			// Runtime/MassEntity Plugin Modules
			"MassEntity",

			// Runtime/MassGameplay Plugin Modules
			"MassActors",
			"MassCommon",
			"MassGameplayDebug",
			"MassLOD",
			"MassMovement",
			"MassNavigation",
			"MassRepresentation",
			"MassReplication",
			"MassSpawner",
			"MassSimulation",
			"MassSignals",
		});
	}
}
3 Likes