Linking Errors with UBlueprintFunctionLibrary

First, let me apologize for my ignorance. I am a C# programmer by day, but can’t seem to get a handle on C++.

I am attempting to create a custom library of some useful functions so I can call them in my Blueprints. From what I read online, the following code should be working, but I am clearly missing something.

.h

#pragma once

#include "Kismet/BlueprintFunctionLibrary.h"
#include "DevotionBlueprintFunctionLibrary.generated.h"

/**
 * 
 */
UCLASS()
class OFFTHEGRID_API UDevotionBlueprintFunctionLibrary : public UBlueprintFunctionLibrary
{
	GENERATED_BODY()

	UFUNCTION(BluePrintCallable, Category = "DevotionLibrary")
	static float GetVectorDistance(FVector A, FVector B);
	
	
};

.cpp

#include "OffTheGrid.h"
#include "DevotionBlueprintFunctionLibrary.h"


float GetVectorDistance(FVector A, FVector B)
{
	return FVector::Dist(A, B);
}

And here is the error I am seeing:

error LNK2019: unresolved external symbol "private: static float __cdecl UDevotionBlueprintFunctionLibrary::GetVectorDistance(struct FVector,struct FVector)" (?GetVectorDistance@UDevotionBlueprintFunctionLibrary@@CAMUFVector@@0@Z) referenced in function "public: void __cdecl UDevotionBlueprintFunctionLibrary::execGetVectorDistance(struct FFrame &,void * const)" (?execGetVectorDistance@UDevotionBlueprintFunctionLibrary@@QEAAXAEAUFFrame@@QEAX@Z)	C:\Users\cheap_000\Projects\OffTheGrid\Intermediate\ProjectFiles\DevotionBlueprintFunctionLibrary.cpp.obj	OffTheGrid

I am sure I am missing something simple - any ideas?

You must put public after GENERATED_BODY(), by default it private and it not allow static to be private

GENERATED_BODY()
 public:
     UFUNCTION(BluePrintCallable, Category = "DevotionLibrary")
     static float GetVectorDistance(FVector A, FVector B);

I added that, and the error wording has changed a bit, but I am still getting a linking error.

error LNK2019: unresolved external symbol "public: static float __cdecl UDevotionBlueprintFunctionLibrary::GetVectorDistance(struct FVector,struct FVector)" (?GetVectorDistance@UDevotionBlueprintFunctionLibrary@@SAMUFVector@@0@Z) referenced in function "public: void __cdecl UDevotionBlueprintFunctionLibrary::execGetVectorDistance(struct FFrame &,void * const)" (?execGetVectorDistance@UDevotionBlueprintFunctionLibrary@@QEAAXAEAUFFrame@@QEAX@Z)	C:\Users\cheap_000\Projects\OffTheGrid\Intermediate\ProjectFiles\DevotionBlueprintFunctionLibrary.cpp.obj	OffTheGrid

I’ve noticed that your function is not in the form

float UDevotionBlueprintFunctionLibrary::GetVectorDistance(FVector A, FVector B)
{
     return FVector::Dist(A, B);
}

You need to specify the class name.
Otherwise the function is not belonging to your class.

D.

This did the trick - thanks to both of you for pointing me in the right direction.