I want to add a UBlueprintFunctionLibrary based class but got link error .Is there a way to solve this?
the code i added is
# header
#pragma once
#include "CoreMinimal.h"
#include "Kismet/BlueprintFunctionLibrary.h"
#include "LandscapeReadyChecker.generated.h"
UCLASS()
class ADDCPP_API ULandscapeReadyChecker : public UBlueprintFunctionLibrary
{
GENERATED_BODY()
public:
UFUNCTION(BlueprintCallable, Category="Landscape")
static bool IsLandscapeReady();
};
# source
#include "LandscapeReadyChecker.h"
#include "ShaderPipelineCache.h"
bool ULandscapeReadyChecker::IsLandscapeReady()
{
return FShaderPipelineCache::NumPrecompilesRemaining() == 0;
}
The project compiles successfully for the ProjectName target (addCpp), but results in a linker error when compiling for the ProjectName+Editor target (add Editor).
Below is the error message
[1/2] Link [Apple] UnrealEditor-addCpp.dylib (UBA disabled)
Undefined symbols for architecture arm64:
"FShaderPipelineCache::NumPrecompilesRemaining()", referenced from:
ULandscapeReadyChecker::IsLandscapeReady() in LandscapeReadyChecker.cpp.o
If I remove ULandscapeReadyChecker class, the project compiles successfully in both target. I’m using UnrealEngine 5.5, Xcode 16, M1 Mac.
Thanks