I am trying to import a third party library for UE4 and use it in an actor. The UE4 documentation recommends creating a plugin to accomplish this and provides an auto generated template which i am trying to test currently.
I have created a blank C++ UE4 Project with a new third party custom plugin and an actor class in which to use the plugin/library.
This is my build.cs file for the main project:
// Copyright Epic Games, Inc. All Rights Reserved.
using UnrealBuildTool;
public class TestGame : ModuleRules
{
    public TestGame(ReadOnlyTargetRules Target) : base(Target)
    {
        PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;
    
        PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore", "CustomTestPlugin" });
        PrivateDependencyModuleNames.AddRange(new string[] { "CustomTestPlugin" });
        PublicIncludePaths.AddRange(new string[] { "../Plugins/CustomTestPlugin/Source/CustomTestPlugin/Public" });
        // Uncomment if you are using Slate UI
        // PrivateDependencyModuleNames.AddRange(new string[] { "Slate", "SlateCore" });
        // Uncomment if you are using online features
        // PrivateDependencyModuleNames.Add("OnlineSubsystem");
        // To include OnlineSubsystemSteam, add it to the plugins section in your uproject file with the Enabled attribute set to true
    }
}
and have included the plugin in the actor cpp file using
#include "CustomTestPlugin.h"
as well as instantiating it in the same file:
    FCustomTestPluginModule pluggin = FCustomTestPluginModule::FCustomTestPluginModule();
when I compile without the above it builds fine but when i declare the pluggin variable it gives the following error:
TestActor.cpp.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl FCustomTestPluginModule::StartupModule(void)" (?StartupModule@FCustomTestPluginModule@@UEAAXXZ)
CustomTestPlugin.h is as follows:
// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "Modules/ModuleManager.h"
class FCustomTestPluginModule : public IModuleInterface
{
public:
    /** IModuleInterface implementation */
    //FCustomTestPluginModule();
    virtual void StartupModule() override;
    virtual void ShutdownModule() override;
private:
    /** Handle to the test dll we will load */
    void*   ExampleLibraryHandle;
};
and the cpp file:
// Copyright Epic Games, Inc. All Rights Reserved.
#include "CustomTestPlugin.h"
#include "Core.h"
#include "Modules/ModuleManager.h"
#include "Interfaces/IPluginManager.h"
#include "CustomTestPluginLibrary/ExampleLibrary.h"
#define LOCTEXT_NAMESPACE "FCustomTestPluginModule"
//FCustomTestPluginModule::FCustomTestPluginModule() {
//  UE_LOG(LogTemp, Warning, TEXT("CustomPluConstructed"));
//}
void FCustomTestPluginModule::StartupModule()
{
    // This code will execute after your module is loaded into memory; the exact timing is specified in the .uplugin file per-module
    // Get the base directory of this plugin
    FString BaseDir = IPluginManager::Get().FindPlugin("CustomTestPlugin")->GetBaseDir();
    // Add on the relative location of the third party dll and load it
    FString LibraryPath;
#if PLATFORM_WINDOWS
    LibraryPath = FPaths::Combine(*BaseDir, TEXT("Binaries/ThirdParty/CustomTestPluginLibrary/Win64/ExampleLibrary.dll"));
#elif PLATFORM_MAC
    LibraryPath = FPaths::Combine(*BaseDir, TEXT("Source/ThirdParty/CustomTestPluginLibrary/Mac/Release/libExampleLibrary.dylib"));
#elif PLATFORM_LINUX
    LibraryPath = FPaths::Combine(*BaseDir, TEXT("Binaries/ThirdParty/CustomTestPluginLibrary/Linux/x86_64-unknown-linux-gnu/libExampleLibrary.so"));
#endif // PLATFORM_WINDOWS
    ExampleLibraryHandle = !LibraryPath.IsEmpty() ? FPlatformProcess::GetDllHandle(*LibraryPath) : nullptr;
    if (ExampleLibraryHandle)
    {
        // Call the test function in the third party library that opens a message box
        ExampleLibraryFunction();
    }
    else
    {
        FMessageDialog::Open(EAppMsgType::Ok, LOCTEXT("ThirdPartyLibraryError", "Failed to load example third party library"));
    }
}
void FCustomTestPluginModule::ShutdownModule()
{
    // This function may be called during shutdown to clean up your module.  For modules that support dynamic reloading,
    // we call this function before unloading the module.
    // Free the dll handle
    FPlatformProcess::FreeDllHandle(ExampleLibraryHandle);
    ExampleLibraryHandle = nullptr;
}
#undef LOCTEXT_NAMESPACE
    
IMPLEMENT_MODULE(FCustomTestPluginModule, CustomTestPlugin)
any help in resolving this would be greatly appreciated thanks!
 
    