OnClicked.AddDynamic giving me error

I am trying to bind a function to onclicked with:

OnClicked.AddDynamic(this, &AChessPiece::OnClick); // <- In AChessPiece's constructor

I have declared OnClick in the ChessPiece.h

void OnClick();

Defined it in ChessPiece.cpp

void AChessPiece::OnClick()
{
    //Do something
}

When ever I try to build this I get an error saying that there is “No matching member function for call to ‘__Internal_AddDynamic’” I have been utterly unsuccessful in determining the cause of this error. Here is the debug info provided by the editor:

What am I doing wrong?

Thank you that works, I am confused though. If the class I am trying to get to react to clicking is a pawn should I change AActor to APawn? Also would you be able to explain the need for those parameters? In most of the examples I see on other posts they are not needed.

Try this:

void AChessPiece::OnClick(AActor* TouchedActor , FKey ButtonPressed)
{

}

I am not sure, I simply just looked up the function delegate and pasted what it should be.

This is the call back of the delegate too. So these are the expected parameters for the function bound to the delegate. How you use them is up to you.

If you want to cast the TouchedActor to see if its a APawn, it would be:

void AChessPiece::OnClick(AActor* TouchedActor , FKey ButtonPressed)
 {
     APawn *TouchedPawn = Cast<APawn>(TouchedActor);
    if(TouchedPawn)
    {
        // Pawn touched....
    }
 }

You would also maybe need to add:

#include "Pawn.h"

at the top of your class.