Hi, I’ve created a new blueprint function library class called “CheckForeground” it’s really simple, I am on 4.22 engine version
The code on Visual Studio is flawless, I mean absolutely no errors But when I go to UE4 Editor and click compile it always fail.
Can you please tell me what I’m doing wrong (the header and the source files are samples)?
IsApplicationForegroundNow.h
#pragma once
#include "CoreMinimal.h"
#include "Kismet/BlueprintFunctionLibrary.h"
#include "IsApplicationForegroundNow.generated.h"
/**
*
*/
UCLASS()
class GAMESAMPLE_API UIsApplicationForegroundNow : public UBlueprintFunctionLibrary
{
GENERATED_BODY()
public:
UFUNCTION(BlueprintPure, Category = "foreground")
static bool IsApplicationForegroundNow();
};
IsApplicationForegroundNow.cpp
#include "GameSample.h"
#include "IsApplicationForegroundNow.h"
#include "Runtime/ApplicationCore/Public/HAL/PlatformApplicationMisc.h"
bool UIsApplicationForegroundNow::IsApplicationForegroundNow()
{
return FPlatformApplicationMisc::IsThisApplicationForeground();
}
Message Log
IsApplicationForegroundNow.cpp.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: static bool __cdecl FWindowsPlatformApplicationMisc::IsThisApplicationForeground(void)" (__imp_?IsThisApplicationForeground@FWindowsPlatformApplicationMisc@@SA_NXZ) referenced in function "public: static bool __cdecl UIsApplicationForegroundNow::IsApplicationForegroundNow(void)" (?IsApplicationForegroundNow@UIsApplicationForegroundNow@@SA_NXZ)
C:\Users\pc\Documents\Unreal Projects\GameSample\Binaries\Win64\UE4Editor-GameSample-4972.dll : fatal error LNK1120: 1 unresolved externals
Why say that is unresolved external, I can view the file PlatformApplicationMish correctly!
Thanks for all your help in advance