TSubClassOf function does not take 1 arguments

Characters in my game can execute 2 special abilities. A component ‘SPlayerAbilityComponent’ attaches to the character to enable this. I can then select their ability from blueprints since it’s a TSubclassOf:
SPlayerAbilityComponent.h:

UPROPERTY(EditAnywhere)
TSubclassOf<class USBaseAbility> AbilityOneClass;

UPROPERTY(EditAnywhere)
TSubclassOf<class USBaseAbility> AbilityTwoClass;

USBaseAbility* AbilityOne;
ASCharacter* OwnedCharacter;

The base class is USBaseAbility and the specific abilities inherit it. For example, USBoostAbility inherits USBaseAbility.
The SPlayerAbilityComponent.cpp creates a new object from the class variable and provides the USBoostAbility with the character when it’s used:

void USPlayerAbilityComponent::UseAbilityOne()
{
	AbilityOne = NewObject<USBoostAbility>(this, USBoostAbility::StaticClass());
	AbilityOne->Use(OwnedCharacter);
	UE_LOG(LogTemp, Warning, TEXT("Ability one used."));

}

But I’m getting an error:
‘USBaseAbility::Use’: function does not take 1 arguments.

syntax error: identifier ‘ASCharacter’.

SBaseAbility.h has a Use function:

void Use(ASCharacter* OwnedCharacter);

and its implementation:

void USBaseAbility::Use(ASCharacter* OwnedCharacter)
{
	// Execute the ability functionality.
	if (!CanUse)
	{
		// Must wait for cooldown.
		UE_LOG(LogTemp, Warning, TEXT("WAIT FOR COOLDOWN"));
		return;
	}

	// Execute the ability and set a timer.
	ExecuteAbility();

I’m providing it with a character argument but it seems to fail.
Any ideas why?

Thank you very much.

Did you include all necessary headers, like the “SCharacter.h” in your component?

I did indeed. SCharacter.h, SBaseAbility.h and SBoostAbility.h are all included in the component. Also included in the SBaseAbility.cpp.

It executes the Use function with no problem when no arguments are required. But when I require an SCharacter* argument it fails.

It executes the Use function with no problem when no arguments are required. But when I require an SCharacter* argument it fails.

So, you have two Use functions, one with no args and another with args? Are they both accessible?

No just one Use function but I’m removing the ‘ASCharacter* OwnedCharacter’ argument to test it out and it works

SCharacter.h, SBaseAbility.h and SBoostAbility.h are all included in the component. Also included in the SBaseAbility.cpp.

Did you include all those both in the .h and .cpp file? If so, then that could be the source of the problem. Remove those includes from the header file and use forward declarations instead.

Yup, I was including SCharacter.h in my SBoostAbility.h file. And I was referencing it incorrectly in the SBaseAbility.cpp (Supposed to be ‘Player/SCharacter.h’ not just ‘SCharacter.h’. Would still be lost without your input. Thanks so much!