Trying to run a function from a line trace gives an error

So I’m not new to c++ programming, but I am new to c++ in unreal. I wanted to make an “Interactable” class, and how it’s meant to work is when a line trace that’s activated by a keypress hits it, it runs an event that can be used in blueprints to make implementation easier. I started making this using the c++ fps template. My “Interact” function is located on the character’s .cpp file. I used PlayerInputComponent->BindAction("Action", IE_Pressed, this, &ATestingGroundsCharacter::Interact); to bind it to my “Action” input mapping. It goes as follows:

void ATestingGroundsCharacter::Interact()
	FHitResult Hit;
	FVector Start = FirstPersonCameraComponent->GetComponentLocation();
	FVector End = ((FirstPersonCameraComponent->GetForwardVector() * 300.f) + Start);
	FCollisionQueryParams CollisionParams;

	DrawDebugLine(GetWorld(), Start, End, FColor::Green, false, 2, 0, 1);

	if (GetWorld()->LineTraceSingleByChannel(Hit, Start, End, ECC_Visibility, CollisionParams))
		if (Hit.bBlockingHit)
			if (Hit.GetActor()->GetClass()->IsChildOf(AInteractable::StaticClass()))

The ButtonPressed() Function/Event is labeled as UFUNCTION(BlueprintNativeEvent, Category = "Events") in the .h file. Here is the function:

void AInteractable::ButtonPressed()
	UE_LOG(LogTemp, Warning, TEXT("Pressed"));

in my The problem is that when I try and compile this, I get these errors:

Interactable.gen.cpp.obj : error LNK2005: “public: void __cdecl AInteractable::ButtonPressed(void)” (?ButtonPressed@AInteractable@@QEAAXXZ) already defined in Interactable.cpp.obj

Interactable.cpp.obj : error LNK2001: unresolved external symbol “public: virtual void __cdecl AInteractable::ButtonPressed_Implementation(void)” (?ButtonPressed_Implementation@AInteractable@@UEAAXXZ)

Interactable.gen.cpp.obj : error LNK2001: unresolved external symbol “public: virtual void __cdecl AInteractable::ButtonPressed_Implementation(void)” (?ButtonPressed_Implementation@AInteractable@@UEAAXXZ)

A:\Users\######\Documents\Unreal Projects\TestingGrounds\Binaries\Win64\UE4Editor-TestingGrounds-0289.dll : fatal error LNK1120: 1 unresolved externals

(I censored my windows user.)

Could anyone help me out?

Is your button pressed function marked as a BlueprintNativeEvent in its UFUNCTION tag? If so, you’ll need to call your function ButtonPressed_Implementation instead of ButtonPressed.