Problem with OnComponentBeginOverlap.AddDynamic?

In a cpp file, my use of:


BoxComp->OnComponentBeginOverlap.AddDynamic(this, &AAICharacter::OnBoxOverlap);
BoxComp->OnComponentEndOverlap.AddDynamic(this, &AAICharacter::OnBoxEndOverlap);

got the following error:

cannot convert argument 2 from ‘void (_cdecl AAICharacter::)(AActor,UPrimitiveComponent*,int32,bool,const FHitResult &)’ to 'void (_cdecl AAICharacter::)(UPrimitiveComponent, AActor*,UPrimitiveComponent*,int32,bool,const FHitResult &)

Here’s what my header file with the associated function looks like:


#include "CoreMinimal.h"
#include "GameFramework/Character.h"
#include "Engine/DataTable.h"
#include "Subtitle.h"
#include "Components/BoxComponent.h"
#include "Components/AudioComponent.h"
#include "AICharacter.generated.h"

/**
* The purpose of this class is to create a dummy AI for testing out the code for character interactions.
*/


UCLASS()
class GV_PROJECT_API AAICharacter : public ACharacter
{
GENERATED_BODY()

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

protected:
// Called when the game starts or when spawned
virtual void BeginPlay() override;

public:
// Called every frame
virtual void Tick(float DeltaTime) override;

// Called to bind functionality to input
virtual void SetupPlayerInputComponent(class UInputComponent* PlayerInputComponent) override;

private:
UFUNCTION()
void OnBoxOverlap(AActor* OtherActor, UPrimitiveComponent* OtherComp, int32 OtherIndex, bool bFromSweep, const FHitResult & SweepResult);

UFUNCTION()
void OnBoxEndOverlap(AActor* OtherActor, UPrimitiveComponent* OtherComp, int32 OtherIndex);

UFUNCTION()
void Talk(USoundBase* SFX, TArray<FSubtitle> Subs);


public:
/*Answers to the character after a specified delay*/
void AnswerToCharacter(FName PlayerLine, TArray<FSubtitle>& SubtitlesToDisplay, float delay);

/*Retrieves the corresponding character lines*/
UDataTable* GetPlayerLines() { return PlayerLines; }

protected:

/*If the player is inside this box component he will be able to initiate a conversation with the pawn*/
UPROPERTY(VisibleAnywhere)
UBoxComponent* BoxComp;

/*The audio component responsible for playing the dialog coming from this pawn*/
UPROPERTY(VisibleAnywhere)
UAudioComponent* AudioComp;

/*The player lines - each pawn can offer different dialog options for our character*/
UPROPERTY(EditAnywhere, Category = DialogSystem)
UDataTable* PlayerLines;

/*The ai lines*/
UPROPERTY(EditAnywhere, Category = DialogSystem)
UDataTable* AILines;
};

Is anyone familiar with this error?

You have a signature mismatch in your code:

(AActor*,UPrimitiveComponent*,int32,bool,const FHitResult &) (wrong signature)
vs
(UPrimitiveComponent*, AActor*,UPrimitiveComponent*,int32,bool,const FHitResult &) (correct signature)