Making A Custom C++ Function BluePrint Implementable

I am modifying the shooter game.
I wrote this declaration in the ShooterCharacter.H File



	UFUNCTION(BlueprintImplementableEvent)
	void SSCustomDamage();


and then I made a function call to it here in the ShooterCharacter.CPP File



float AShooterCharacter::TakeDamage(float Damage, struct FDamageEvent const& DamageEvent, class AController* EventInstigator, class AActor* DamageCauser)
{
	AShooterPlayerController* MyPC = Cast<AShooterPlayerController>(Controller);
	SSCustomDamage();
	if (MyPC && MyPC->HasGodMode())
	{
		return 0.f;
	}

	if (Health <= 0.f)
	{
		return 0.f;
	}

	// Modify based on game rules.
	AShooterGameMode* const Game = GetWorld()->GetAuthGameMode<AShooterGameMode>();
	Damage = Game ? Game->ModifyDamage(Damage, this, DamageEvent, EventInstigator, DamageCauser) : 0.f;

	const float ActualDamage = Super::TakeDamage(Damage, DamageEvent, EventInstigator, DamageCauser);
	if (ActualDamage > 0.f)
	{
		Health -= ActualDamage;
		if (Health <= 0)
		{
			Die(ActualDamage, DamageEvent, EventInstigator, DamageCauser);
		}
		else
		{
			PlayHit(ActualDamage, DamageEvent, EventInstigator ? EventInstigator->GetPawn() : NULL, DamageCauser);
		}

		MakeNoise(1.0f, EventInstigator ? EventInstigator->GetPawn() : this);
	}

	return ActualDamage;
}


Then I did the rest in BluePrint. Everything works fine and does exactly what I want it to do in the editor.
It builds fine with no errors or warnings in visual studio.

Those 3 lines of code are all that I changed 2 lines for the function declaration and 1 line to call to it.

But I am getting LNK 2019 error when I Package the project, and I get these warnings in my Unreal Logs
that point back to my function:


MainFrameActions: Packaging (Windows (64-bit)): UnrealBuildTool: Creating library C:\Users\Colorado\Documents\Unreal Projects\ShooterGame\Survival-Shooter\Binaries\Win64\ShooterGame.lib and object C:\Users\Colorado\Documents\Unreal Projects\ShooterGame\Survival-Shooter\Binaries\Win64\ShooterGame.exp
MainFrameActions: Packaging (Windows (64-bit)): UnrealBuildTool: Module.ShooterGame.cpp.obj : error LNK2019: unresolved external symbol “public: void __cdecl AShooterCharacter::SSCustomDamage(void)” (?SSCustomDamage@AShooterCharacter@@QEAAXXZ) referenced in function “public: virtual float __cdecl AShoot
MainFrameActions: Packaging (Windows (64-bit)): erCharacter::TakeDamage(float,struct FDamageEvent const &,class AController *,class AActor *)” (?TakeDamage@AShooterCharacter@@UEAAMMAEBUFDamageEvent@@PEAVAController@@PEAVAActor@@@Z)
MainFrameActions: Packaging (Windows (64-bit)): UnrealBuildTool: C:\Users\Colorado\Documents\Unreal Projects\ShooterGame\Survival-Shooter\Binaries\Win64\ShooterGame.exe : fatal error LNK1120: 1 unresolved externals
MainFrameActions: Packaging (Windows (64-bit)): UnrealBuildTool: -------- End Detailed Actions Stats -----------------------------------------------------------
MainFrameActions: Packaging (Windows (64-bit)): UnrealBuildTool: ERROR: UBT ERROR: Failed to produce item: C:\Users\Colorado\Documents\Unreal Projects\ShooterGame\Survival-Shooter\Binaries\Win64\ShooterGame.exe


Did I do something wrong?
Am I supposed to write more code to make a Blueprint Implementable Function?

It ended up building fine when I set it to 32 bit???

I would still love to know what went wrong

That can be overridden in the blueprint so shouldn’t it be virtual with a default (nop) implementation in AShooterCharacter?

I don’t see why compiling for 32-bit solved this; that must be a red herring.

No the declaration is correct, it shouldn’t be virtual. The generated code implements the override functionality.

My first guess would be that there’s nothing wrong with the code and perhaps this is an issue with UBT not being aware of exactly what it needs to rebuild. I seem to have similar issues sporadically, though I’ve not seen anything exactly like this before. It kind of looks though as if UHT has not been rerun on the header file in question, so the function implementation hasn’t been added.

Try doing a full clean/rebuild of the configuration you’re trying to package (ideally also manually deleting intermediate folder and regenerating project files) and see if that fixes it.