Download

Cant compile UFUNCTION.

Im trying to make access modifiers for my private stamina variables. .h firstpersoncharacter file:


public:
        UFUNCTION(BlueprintPure, Category = "Massacre stats")
		float GetMaxStamina();
	UFUNCTION(BlueprintCallable, Category = "Massacre stats")
		float GetCurrentStamina();

Getting error:


Error MyProject.generated.cpp.obj : error LNK2019: unresolved external symbol "public: float __cdecl AMyProjectCharacter::GetMaxStamina(void)" (?GetMaxStamina@AMyProjectCharacter@@QEAAMXZ) referenced in function "public: void __cdecl AMyProjectCharacter::execGetMaxStamina(struct FFrame &,void * const)" (?execGetMaxStamina@AMyProjectCharacter@@QEAAXAEAUFFrame@@QEAX@Z)
Error MyProject.generated.cpp.obj : error LNK2019: unresolved external symbol "public: float __cdecl AMyProjectCharacter::GetCurrentStamina(void)" (?GetCurrentStamina@AMyProjectCharacter@@QEAAMXZ) referenced in function "public: void __cdecl AMyProjectCharacter::execGetCurrentStamina(struct FFrame &,void * const)" (?execGetCurrentStamina@AMyProjectCharacter@@QEAAXAEAUFFrame@@QEAX@Z)
Error C:\Users\Tomas\Documents\Unreal Projects\MyProject\Binaries\Win64\UE4Editor-MyProject-8496.dll : fatal error LNK1120: 2 unresolved externals


I want to make ufunctions so I can make HUD with stamina in umg.

You need to also define the implementation of those functions in your .cpp file.