Linker error trying to cast to UWidgetComponent

So I currently have a Blueprint that I am converting into C++. I am passing in a UObject and casting it to various different components and then setting some different variables. I have the following code block for checking a UWidgetComponent where ComponentObject, Component_InteractionMesh, and _objectToAddHighlightComp are all UObjects:

UWidgetComponent* widget = Cast<UWidgetComponent>(ComponentObject);
	if (widget != nullptr)
	{
		if (Component_InteractionMesh == nullptr)
		{
			Component_InteractionMesh = widget;
		}

		_objectToAddHighlightComp = widget;
		return;
	}

I don’t get any visible errors and I have the necessary include for UWidgetComponent. However, when I try to compile the project I get the following error:

SCC_ObjectBase.cpp.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) private: static class UClass * _cdecl UWidgetComponent::GetPrivateStaticClass(void)" (_imp_?GetPrivateStaticClass@UWidgetComponent@@CAPEAVUClass@@XZ) referenced in function "public: virtual void __cdecl USCC_ObjectBase::ExtractHighlightMeshes(class UObject *,class UObject * &,bool &,bool &,struct FVector &)" (?ExtractHighlightMeshes@USCC_ObjectBase@@UEAAXPEAVUObject@@AEAPEAV2@AEA_N2AEAUFVector@@@Z)

Can anyone explain what I am doing wrong here? Any help would be greatly appreciated.

It seems I was missing the UMG module… :stuck_out_tongue: