I have been trying to replicate functions but these errors keep occurring I have #included
MyCharacter.gen.cpp.obj : error LNK2005: “public: void __cdecl AMyCharacter::HandleFire(void)” (?HandleFire@AMyCharacter@@QEAAXXZ) already defined in MyCharacter.cpp.obj
and
MyCharacter.cpp.obj : error LNK2001: unresolved external symbol “public: virtual void __cdecl AMyCharacter::HandleFire_Implementation(void)” (?HandleFire_Implementation@AMyCharacter@@UEAAXXZ)
and
MyCharacter.cpp.obj : error LNK2019: unresolved external symbol “public: __cdecl AMyCharacter::AMyCharacter(class FObjectInitializer const &)” (??0AMyCharacter@@QEAA@AEBVFObjectInitializer@@@Z) referenced in function “public: static void __cdecl AMyCharacter::__DefaultConstructor(class FObjectInitializer const &)” (?__DefaultConstructor@AMyCharacter@@SAXAEBVFObjectInitializer@@@Z)
please help me I have had this error for a week now
###character.h
FTimerHandle FiringTimer;
UPROPERTY(EditDefaultsOnly, Category = "Gameplay")
float FireRate;
bool bIsFiringWeapon;
UFUNCTION(BlueprintCallable, Category = "Gameplay")
void StartFire();
UFUNCTION(BlueprintCallable, Category = "Gameplay")
void StopFire();
UFUNCTION(Server, Reliable)
void HandleFire();
###character.cpp
void AMyCharacter::StartFire()
{
if (!bIsFiringWeapon)
{
bIsFiringWeapon = true;
UWorld* World = GetWorld();
World->GetTimerManager().SetTimer(FiringTimer, this, &AMyCharacter::StopFire, FireRate, false);
HandleFire();
}
}
void AMyCharacter::StopFire()
{
bIsFiringWeapon = false;
}
void AMyCharacter::HandleFire()
{
FVector spawnLocation = GetActorLocation() + (GetControlRotation().Vector() * 100.0f) + (GetActorUpVector() * 50.0f);
FRotator spawnRotation = GetControlRotation();
FActorSpawnParameters spawnParameters;
spawnParameters.Instigator = Instigator;
spawnParameters.Owner = this;
}