Skip to content

Instantly share code, notes, and snippets.

@Stiner
Created January 5, 2023 07:44
Show Gist options
  • Select an option

  • Save Stiner/9c72fb9b5dc766b4dcc3fc9a4e065721 to your computer and use it in GitHub Desktop.

Select an option

Save Stiner/9c72fb9b5dc766b4dcc3fc9a4e065721 to your computer and use it in GitHub Desktop.

GetLifetimeReplicatedProps 링크 오류

class AGameCharacter : public ACharacter
{
protected:
    UPROPERTY(Replicated)
    int isJumping;

public:
    void GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const override;
}

위의 클래스를 상속받아 APlayerCharacter를 선언.

class APlayerCharacter : public AGameCharacter
{
protected:
    UPROPERTY(Replicated)
    bool isWalking;
}

이렇게 하면 링크 과정에서 심볼 찾을 수 없다고 오류 남.

PlayerCharacter.gen.cpp.obj : error LNK2001: 확인할 수 없는 외부 기호 "public: virtual void __cdecl APlayerCharacter::GetLifetimeReplicatedProps(class TArray<class FLifetimeProperty,class TSizedDefaultAllocator<32> > &)const " (?GetLifetimeReplicatedProps@APlayerCharacter@@UEBAXAEAV?$TArray@VFLifetimeProperty@@V?$TSizedDefaultAllocator@$0CA@@@@@@Z)
PlayerCharacter.cpp.obj : error LNK2001: 확인할 수 없는 외부 기호 "public: virtual void __cdecl APlayerCharacter::GetLifetimeReplicatedProps(class TArray<class FLifetimeProperty,class TSizedDefaultAllocator<32> > &)const " (?GetLifetimeReplicatedProps@APlayerCharacter@@UEBAXAEAV?$TArray@VFLifetimeProperty@@V?$TSizedDefaultAllocator@$0CA@@@@@@Z)

원인은 APlayerCharacter::isWalking 의 UPROPERTY에 Replicated를 선언한 것 때문에, APlayerCharacter.generated.h 파일을 갱신할때 자동으로 GetLifetimeReplicatedProps 선언을 추가 해 주게 된다. 그렇다보니 APlayerCharacter::GetLifetimeReplicatedProps 의 구현을 찾을 수가 없게 되는것 이였다.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment