Download

C++ blueprint function with input variables

I am trying to create a function in C++ that can be added in the blueprint of the object, and it needs to have input variables. Should be very easy but I can’t figure out why I keep getting errors…


UFUNCTION(BlueprintCallable, Category = "SomeCategory")
static bool somefunction(FString SomeString, bool aBool);

I found an example here

But it doesn’t work in my case, I keep getting an error:


ChildrensBook.generated.cpp.obj : error LNK2001: unresolved external symbol "public: static bool __cdecl ACBPlayerController::somefunction(class FString,bool)" (?somefunction@ACBPlayerController@@SA_NVFString@@_N@Z)
1>D:\Basecamp Games\Projects\UE4 Project\ChildrensBook\Binaries\Win64\UE4Editor-ChildrensBook.dll : fatal error LNK1120: 1 unresolved externals

I see there is something wrong with the function, but no idea what exactly, and how I should do this otherwise …

Thanks for any help in advance!

Alexander

You need to implement this function in your .cpp file. At least the way you declared it.