Error LNK2019

This is the problem I encountered with the error message

10>GM_EditorBase.cpp.obj: Error LNK2019 : unresolved external symbol "public: void __cdecl FMyMainFrameModuleModule::TestModuleLoad(void)" (?TestModuleLoad@FMyMainFrameModuleModule@@QEAAXXZ),function"public: virtual void __cdecl AGM_EditorBase::BeginPlay(void)" (?BeginPlay@AGM_EditorBase@@UEAAXXZ) The symbol was referenced in the middle
10>UnrealEditor-EditorInterface.dll: Error LNK1120 : 1 unresolved external command

When defining a custom module, I want to call a function in the module, but I keep getting the problem that the function is not defined correctly. Here is my code

void AGM_EditorBase::BeginPlay()
{
	Super::BeginPlay();
	
	FMyMainFrameModuleModule& MainFrameModule = FModuleManager::LoadModuleChecked<FMyMainFrameModuleModule>(MainFrame);
	if (FModuleManager::Get().IsModuleLoaded(MainFrame))
	{
		UE_LOG(LogTemp, Type::Warning, TEXT("Is Loading MyMainFrameModule"));
		MainFrameModule.TestModuleLoad();
	}
	
class FMyMainFrameModuleModule : public IModuleInterface
{
public:
    virtual void StartupModule() override;
    virtual void ShutdownModule() override;

    void TestModuleLoad();
}

void FMyMainFrameModuleModule::TestModuleLoad()
{
	UE_LOG(LogTemp, Type::Display , TEXT("the FMyMainFrameModuleModule::TestModuleLoad is been Load"));
}

Thank you for your help

You are missing the MODULE_API macro on the FMyMainFrameModuleModule class.
You may also be missing that module as a dependency in the build.cs for the module that GM_EditorBase resides in. But definitely the first one.

1 Like

Thank you very much, my issue has been resolved!! :+1: :+1: :+1: