# Errors when building plugin.

**URL:** <https://forums.unrealengine.com/t/errors-when-building-plugin/857999>\
**Category:** C++\
**Tags:** unreal-engine, Plugins, CPP, question\
**Created:** [April 6, 2023, 4:10am UTC](https://forums.unrealengine.com/t/errors-when-building-plugin/857999 "2023-04-06T04:10:52Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![JC\_CE](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@JC\_CE](https://forums.unrealengine.com/u/JC_CE)\
**Post date:** [April 6, 2023, 4:10am UTC](https://forums.unrealengine.com/t/errors-when-building-plugin/857999/1 "2023-04-06T04:10:53Z")

</div>

Hello,

I am trying to build a plugin to expose some of the functionality of LibSSH2 to blueprints. But every time I try to build the plugin I am getting link errors.

So this is what I do first:

1. I built the .lib and .dll files like described here: [libssh2/INSTALL\_CMAKE.md at master · libssh2/libssh2 · GitHub](https://github.com/libssh2/libssh2/blob/master/docs/INSTALL_CMAKE.md). My build script was:

```auto
git clone https://github.com/libssh2/libssh2.git
cd libssh2
mkdir bin
cd bin
cmake -DBUILD_SHARED_LIBS=ON ..
cmake --build . --target install

```

Giving me the libssh2.dll and libssh2.lib file in the \bin\src\Debug folder.

1. I put the .dll and .lib files in their respective folders, like shown in this picture.  

2. Edited the build file of my plugin (C\_SSH.Build.cs) so it looks like this:

```auto
using System;
using System.IO;
using UnrealBuildTool;

public class C_SSH : ModuleRules
{
    private string ModulePath
    {
        get { return ModuleDirectory; }
    }

    private string ThirdPartyPath
    {
        get { return Path.GetFullPath(Path.Combine(ModulePath, "../../ThirdParty/")); }
    }

    private string BinariesPath
    {
        get { return Path.GetFullPath(Path.Combine(ModulePath, "../../Binaries/")); }
    }

    private string LibraryPath
    {
        get { return Path.GetFullPath(Path.Combine(ThirdPartyPath, "LibSSH2", "Lib")); }
    }

    public C_SSH(ReadOnlyTargetRules Target) : base(Target)
    {
        PCHUsage = ModuleRules.PCHUsageMode.UseExplicitOrSharedPCHs;

        PublicIncludePaths.AddRange(new string[] { "C_SSH/Public", Path.Combine(ThirdPartyPath, "LibSSH2", "Include"), });
        PrivateIncludePaths.AddRange(new string[] { "Private", });
        PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "Projects", "InputCore", "Icmp" });
        PrivateDependencyModuleNames.AddRange(new string[] { "CoreUObject", });
        DynamicallyLoadedModuleNames.AddRange(new string[] { });

        LoadLibSSH2(Target);
    }

    public bool LoadLibSSH2(ReadOnlyTargetRules Target)
    {
        bool isLibrarySupported = false;

        if (Target.Platform == UnrealTargetPlatform.Win64)
        {
            isLibrarySupported = true;

            // Add the import library
            PublicAdditionalLibraries.Add(Path.Combine(LibraryPath, "Win64", "libssh2.lib"));

            // Delay-load the DLL, so we can load it from the right place first
            PublicDelayLoadDLLs.Add("libssh2.dll");
        }

        return isLibrarySupported;
    }
}

```

But after building the project I get these errors:

```auto
1>Module.C_SSH.cpp.obj : error LNK2019: unresolved external symbol __imp_libssh2_init referenced in function "private: void__ cdecl SSH_Impl::Connect_Int(void)" (?Connect_Int@SSH_Impl@@AEAAXXZ)
1>Module.C_SSH.cpp.obj : error LNK2019: unresolved external symbol __imp_libssh2_exit referenced in function "public:__ cdecl SSH_Impl::~SSH_Impl(void)" (??1SSH_Impl@@QEAA@XZ)
1>Module.C_SSH.cpp.obj : error LNK2019: unresolved external symbol __imp_libssh2_session_init_ex referenced in function "private: void__ cdecl SSH_Impl::Connect_Int(void)" (?Connect_Int@SSH_Impl@@AEAAXXZ)
1>Module.C_SSH.cpp.obj : error LNK2019: unresolved external symbol __imp_libssh2_session_handshake referenced in function "private: void__ cdecl SSH_Impl::Connect_Int(void)" (?Connect_Int@SSH_Impl@@AEAAXXZ)
1>Module.C_SSH.cpp.obj : error LNK2019: unresolved external symbol __imp_libssh2_session_disconnect_ex referenced in function "public:__ cdecl SSH_Impl::~SSH_Impl(void)" (??1SSH_Impl@@QEAA@XZ)
1>Module.C_SSH.cpp.obj : error LNK2019: unresolved external symbol __imp_libssh2_session_free referenced in function "public:__ cdecl SSH_Impl::~SSH_Impl(void)" (??1SSH_Impl@@QEAA@XZ)
1>Module.C_SSH.cpp.obj : error LNK2019: unresolved external symbol __imp_libssh2_session_hostkey referenced in function "private: void__ cdecl SSH_Impl::Connect_Int(void)" (?Connect_Int@SSH_Impl@@AEAAXXZ)
1>Module.C_SSH.cpp.obj : error LNK2019: unresolved external symbol __imp_libssh2_session_last_error referenced in function "private: void__ cdecl SSH_Impl::ExecuteCommand_Int(class FString const &)" (?ExecuteCommand_Int@SSH_Impl@@AEAAXAEBVFString@@@Z)
1>Module.C_SSH.cpp.obj : error LNK2019: unresolved external symbol __imp_libssh2_session_block_directions referenced in function "private: void__ cdecl SSH_Impl::ExecuteCommand_Int(class FString const &)" (?ExecuteCommand_Int@SSH_Impl@@AEAAXAEBVFString@@@Z)
1>Module.C_SSH.cpp.obj : error LNK2019: unresolved external symbol __imp_libssh2_userauth_password_ex referenced in function "public: bool__ cdecl SSH_Impl::Authenticate(void)" (?Authenticate@SSH_Impl@@QEAA_NXZ)
1>Module.C_SSH.cpp.obj : error LNK2019: unresolved external symbol __imp_libssh2_channel_open_ex referenced in function "private: void__ cdecl SSH_Impl::ExecuteCommand_Int(class FString const &)" (?ExecuteCommand_Int@SSH_Impl@@AEAAXAEBVFString@@@Z)
1>Module.C_SSH.cpp.obj : error LNK2019: unresolved external symbol __imp_libssh2_channel_process_startup referenced in function "private: void__ cdecl SSH_Impl::ExecuteCommand_Int(class FString const &)" (?ExecuteCommand_Int@SSH_Impl@@AEAAXAEBVFString@@@Z)
1>Module.C_SSH.cpp.obj : error LNK2019: unresolved external symbol __imp_libssh2_channel_read_ex referenced in function "private: void__ cdecl SSH_Impl::ExecuteCommand_Int(class FString const &)" (?ExecuteCommand_Int@SSH_Impl@@AEAAXAEBVFString@@@Z)
1>Module.C_SSH.cpp.obj : error LNK2019: unresolved external symbol __imp_libssh2_channel_get_exit_status referenced in function "private: void__ cdecl SSH_Impl::ExecuteCommand_Int(class FString const &)" (?ExecuteCommand_Int@SSH_Impl@@AEAAXAEBVFString@@@Z)
1>Module.C_SSH.cpp.obj : error LNK2019: unresolved external symbol __imp_libssh2_channel_get_exit_signal referenced in function "private: void__ cdecl SSH_Impl::ExecuteCommand_Int(class FString const &)" (?ExecuteCommand_Int@SSH_Impl@@AEAAXAEBVFString@@@Z)
1>Module.C_SSH.cpp.obj : error LNK2019: unresolved external symbol __imp_libssh2_channel_close referenced in function "private: void__ cdecl SSH_Impl::ExecuteCommand_Int(class FString const &)" (?ExecuteCommand_Int@SSH_Impl@@AEAAXAEBVFString@@@Z)
1>Module.C_SSH.cpp.obj : error LNK2019: unresolved external symbol __imp_libssh2_channel_free referenced in function "private: void__ cdecl SSH_Impl::ExecuteCommand_Int(class FString const &)" (?ExecuteCommand_Int@SSH_Impl@@AEAAXAEBVFString@@@Z)
1>Module.C_SSH.cpp.obj : error LNK2019: unresolved external symbol __imp_libssh2_knownhost_init referenced in function "private: void__ cdecl SSH_Impl::Connect_Int(void)" (?Connect_Int@SSH_Impl@@AEAAXXZ)
1>Module.C_SSH.cpp.obj : error LNK2019: unresolved external symbol __imp_libssh2_knownhost_checkp referenced in function "private: void__ cdecl SSH_Impl::Connect_Int(void)" (?Connect_Int@SSH_Impl@@AEAAXXZ)
1>Module.C_SSH.cpp.obj : error LNK2019: unresolved external symbol __imp_libssh2_knownhost_free referenced in function "private: void__ cdecl SSH_Impl::Connect_Int(void)" (?Connect_Int@SSH_Impl@@AEAAXXZ)
1>Module.C_SSH.cpp.obj : error LNK2019: unresolved external symbol __imp_libssh2_knownhost_readfile referenced in function "private: void__ cdecl SSH_Impl::Connect_Int(void)" (?Connect_Int@SSH_Impl@@AEAAXXZ)
1>Module.C_SSH.cpp.obj : error LNK2019: unresolved external symbol __imp_libssh2_knownhost_writefile referenced in function "private: void__ cdecl SSH_Impl::Connect_Int(void)" (?Connect_Int@SSH_Impl@@AEAAXXZ)

```

Does anyone have any idea on how to fix this? I already rebuilt the project, regenerated the visual studio project files. But nothing seems to work.

Any help would be so nice!

Thank you!
