Replicated Property is resulting in unresolved external error

I’m getting an unresolved external symbol from my generated header file or something. This property (remaining time) is replicated and thus a GetLifetimeReplicatedProps function is generated in the generated header. I’m not sure how to solve this. I’m mimicking the ShooterGameState.h.

// PropHuntGameState.h
#pragma once

#include "GameFramework/GameState.h"
#include "PropHuntGameState.generated.h"

/**
 * 
 */
UCLASS()
class THIRDPERSONBP_API APropHuntGameState : public AGameState
{
	GENERATED_UCLASS_BODY()

	/** time left for warmup / match */
	UPROPERTY(Transient, Replicated)
	int32 RemainingTime;
	
	
};

1> Creating library C:\Users\Cobryis\Dev\Unreal\ThirdPersonBP\Intermediate\Build\Win64\ThirdPersonBPEditor\DebugGame\UE4Editor-ThirdPersonBP-Win64-DebugGame.lib and object C:\Users\Cobryis\Dev\Unreal\ThirdPersonBP\Intermediate\Build\Win64\ThirdPersonBPEditor\DebugGame\UE4Editor-ThirdPersonBP-Win64-DebugGame.exp
1>PropHuntBase.cpp.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl APropHuntGameState::GetLifetimeReplicatedProps(class TArray &)const " (?GetLifetimeReplicatedProps@APropHuntGameState@@UEBAXAEAV?$TArray@VFLifetimeProperty@@VFDefaultAllocator@@@@@Z)
1>PropHuntGameState.cpp.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl APropHuntGameState::GetLifetimeReplicatedProps(class TArray &)const " (?GetLifetimeReplicatedProps@APropHuntGameState@@UEBAXAEAV?$TArray@VFLifetimeProperty@@VFDefaultAllocator@@@@@Z)
1>ThirdPersonBP.generated.cpp.obj : error LNK2019: unresolved external symbol "public: virtual void __cdecl APropHuntGameState::GetLifetimeReplicatedProps(class TArray &)const " (?GetLifetimeReplicatedProps@APropHuntGameState@@UEBAXAEAV?$TArray@VFLifetimeProperty@@VFDefaultAllocator@@@@@Z) referenced in function “class UFunction * __cdecl Z_Construct_UFunction_ATestHUD_OnChatTextSubmitted(void)” (?Z_Construct_UFunction_ATestHUD_OnChatTextSubmitted@@YAPEAVUFunction@@anonymous_user_9674a66c)
1>C:\Users\Cobryis\Dev\Unreal\ThirdPersonBP\Binaries\Win64\UE4Editor-ThirdPersonBP-Win64-DebugGame.dll : fatal error LNK1120: 1 unresolved externals

Oh, I’m not very bright. If I had bothered to look at the wiki I would have realized that I do have to write the implementation myself.

I just fell for the same think myself. Thanks for answering your question :wink:

Why have you inserted a link to the wiki instead of the particular article?

If you look at the URL I posted 8 years ago you’ll see it was to a specific wiki page. But Epic deprecated their wiki so thus it takes you to some page about the wiki being shut down.

Searching on ddg for this i found

Thanks John Pollard
and also in zhong wen https://zhuanlan.zhihu.com/p/548696050

just for the record is something like this


void AActor::GetLifetimeReplicatedProps( TArray< FLifetimeProperty > & OutLifetimeProps ) const
{
// AActor is the owning class, Owner is the name of the property 
    DOREPLIFETIME( AActor, Owner ); 
}