Compile error LNK2019: unresolved external symbol

No idea why this is happening. I tried adding the “AIModule” to ExtraModuleNames in my *.Target.cs files to no avail. What’s wrong here? The specific error occurs when I do the CreateDefaultSubobject line in cpp file.

My code- RPGCharacterBase.h:

#pragma once

#include "CoreMinimal.h"
#include "GameFramework/Character.h"
#include "Perception/PawnSensingComponent.h"
#include "RPGCharacterBase.generated.h"

UCLASS()
class RPG_API ARPGCharacterBase : public ACharacter
{
	GENERATED_BODY()

public:
	// Sets default values for this character's properties
	ARPGCharacterBase();

	UPROPERTY(EditDefaultsOnly)
	UPawnSensingComponent* PawnSenses;
};

.cpp file

#include "RPGCharacterBase.h"

// Sets default values
ARPGCharacterBase::ARPGCharacterBase()
{
	PawnSenses = CreateDefaultSubobject<UPawnSensingComponent>(TEXT("PawnSensing"));
}

Exact error is:

RPGCharacterBase.cpp.obj : error
LNK2019: unresolved external symbol
“__declspec(dllimport) private: static
class UClass * __cdecl
UPawnSensingComponent::GetPrivateStaticClass(void)”
(_imp?GetPrivateStaticClass@UPawnSensingComponent@@CAPEAVUClass@@anonymous_user_9674a66c)
referenced in function “public:
__cdecl ARPGCharacterBase::ARPGCharacterBase(void)”
(??0ARPGCharacterBase@@QEAA@XZ)
2>RPGCharacterBase.gen.cpp.obj : error
LNK2019: unresolved external symbol
“__declspec(dllimport) class UClass *
__cdecl Z_Construct_UClass_UPawnSensingComponent_NoRegister(void)”
(_imp?Z_Construct_UClass_UPawnSensingComponent_NoRegister@@YAPEAVUClass@@anonymous_user_9674a66c)
referenced in function “void __cdecl
`dynamic initializer for ‘public:
static struct
UE4CodeGen_Private::FObjectPropertyParams
const
Z_Construct_UClass_ARPGCharacterBase_Statics::NewProp_PawnSenses’'(void)”
(??__E?NewProp_PawnSenses@Z_Construct_UClass_ARPGCharacterBase_Statics@@2UFObjectPropertyParams@UE4CodeGen_Private@@anonymous_user_31e84eb0@@YAXXZ)

Turns out the AIModule needed to be in the build.cs and not the target.cs file.