ue4 custom functions in c++

I just start learning c++ in ue4 and have quastion I found tutorial how create custom function and call it in exist blueprint, so i copy this code and some functions this code return errors for example getactorlocation(), i need add some #include in .ccp and .h file?

still not working some problem with InChar

GarnerP57 thx I I appreciate your time, becouse find solution in internet is very hard. Why coding in c++ this engine is so hard I try made ultra simple function and every step I got error. After when you add me solution i was error target so i find i must add static void, now when everything should be fine I have ue4 crash to descop after start play wtf?

#include “MyBlueprintFunctionLibrary.h”
#include “GameFramework/Character.h”

void UMyBlueprintFunctionLibrary::MyFunction(ACharacter * InChar, FVector & out)
FVector vector = InChar->GetActorForwardVector();
out = vector;


#include “CoreMinimal.h”
#include “Kismet/BlueprintFunctionLibrary.h”
#include “MyBlueprintFunctionLibrary.generated.h”

class MYPROJECT1_API UMyBlueprintFunctionLibrary : public UBlueprintFunctionLibrary

    UFUNCTION(BlueprintCallable, Category = "Character")
    static void MyFunction(ACharacter* InChar, FVector& out);