⭐ Unreal Engine/UE Debugging Log

[UE] Build.cs에서 빠진게 있어 빌드가 안 되는 경우

Designerd 2024. 10. 8. 09:17

Build.cs에서 빠진게 있어 빌드가 안 되는 경우, 에러 메시지를 띄운다.

 

목차

     

     


     

    Build.cs에서 빠진게 있어 빌드가 안 되는 경우


     

     

    문제 상황

     

    아래와 같은 에러 문구를 띄우며 컴파일에 실패했다.

     

    1>PopupBase.cpp.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: static struct FKey const EKeys::Escape" (__imp_?Escape@EKeys@@2UFKey@@B) referenced in function "public: virtual bool __cdecl UPopupBase::HandleKeyDownEvent(struct FKeyEvent const &)" (?HandleKeyDownEvent@UPopupBase@@UEAA_NAEBUFKeyEvent@@@Z)
    1>D:\Perforce\ 파일 경로(사용자마다 다름) \Binaries\Win64\UnrealEditor-EsCommons.dll : fatal error LNK1120: 1 unresolved externals

     


     

     

    문제 원인 분석하기

     

    컴파일러가 띄운 에러 문구를 분석해보자.

     

    error LNK2019,  fatal error LNK1120

    • 링크 에러 문구다. 뭔가를 가지고 올 수 없어 발생한 문제다.

     

    LNK2019: unresolved external symbol "__declspec(dllimport) public: static struct FKey const EKeys::Escape" (__imp_?Escape@EKeys@@2UFKey@@B) referenced in function "public: virtual bool __cdecl UPopupBase::HandleKeyDownEvent(struct FKeyEvent const &)"

    • UPopupBase::HandleKeyDownEvent(struct FKeyEvent const &) 함수에서 문제가 발생 했음을 알 수 있다.
    bool UPopupBase::HandleKeyDownEvent(const FKeyEvent& InKeyEvent)
    {
    	if (InKeyEvent.GetKey() == EKeys::Escape)
    	{
    		return true;
    	}
    
    	return false;
    }

     

    • __imp_?Escape@EKeys@@2UFKey@@B
      • EKeys::Escape 부분에서 문제가 발생 했음을 알 수 있다.
      • EKey가 선언된 위치를 확인하면 InputCoreTypes.h 임을 알 수 있다.

     

     

    결국 InputCoreTypes.h을 찾지 못해 발생한 문제란 것을 알 수 있다.

     


     

     

    해결 방안

     

    Build.cs의 PrivateDependencyModuleNames에 "InputCore" 을 추가해야 한다.

     

    .Build.cs

    public class 빌드cs이름 : ModuleRules{
        public GameBase(ReadOnlyTargetRules Target) : base(Target)
        {
            PrivateDependencyModuleNames.AddRange( new[]{
            		...
                    "InputCore" });
        }
    }

     


     

     

    결과

     

    컴파일 성공!