Hey there, I’m trying to create a plugin that uses some third party libraries. I followed this tutorial to set my plugin up: Unreal Engine: Including a Third-Party Library (on the example of the Point Cloud Library and Boost) [Tutorial] [Download] – Valentin Kraft's Portfolio
Unfortunately, I get the following error:
error C4273: “rsb::getFactory”:
Inconsistent dll linkage.
I placed my dlls in all possible folders. The plugins Binaries, the projects Binaries, and so on… but the error won’t dissapear. I linked all my .lib files as described in the tutorial and I think they can be found because I don’t get any errors with them.
I added the module in my plugins .Build.cs like this:
using UnrealBuildTool;
public class RSBInterface : ModuleRules
{
public RSBInterface(ReadOnlyTargetRules Target) : base(Target)
{
PCHUsage = ModuleRules.PCHUsageMode.UseExplicitOrSharedPCHs;
PublicIncludePaths.AddRange(
new string[] {
// ... add public include paths required here ...
//"RSBInterface/Public"
}
);
PrivateIncludePaths.AddRange(
new string[] {
// ... add other private include paths required here ...
"RSBInterface/Private",
"RSBInterface/Public"
}
);
PublicDependencyModuleNames.AddRange(
new string[]
{
"Core",
// ... add other public dependencies that you statically link with here ...
"RSBModule"
}
);
PrivateDependencyModuleNames.AddRange(
new string[]
{
"CoreUObject",
"Engine",
"Slate",
"SlateCore"
// ... add private dependencies that you statically link with here ...
}
);
DynamicallyLoadedModuleNames.AddRange(
new string[]
{
// ... add any modules that your module loads dynamically here ...
}
);
// Since the PCL module needs this, we also have to use these flags here
bUseRTTI = true;
bEnableExceptions = true;
//bEnableUndefinedIdentifierWarnings = false;
}
}
And in my modules .Build.cs I included all the libs like this:
using System.IO;
using System;
using UnrealBuildTool;
public class RSBModule : ModuleRules
{
private string ModulePath
{
get { return ModuleDirectory; }
}
private string BinariesPath
{
get { return Path.GetFullPath(Path.Combine(ModulePath, "../Binaries/")); }
}
public RSBModule(ReadOnlyTargetRules Target) : base(Target)
{
// Tell Unreal that this Module only imports Third-Party-Assets
Type = ModuleType.External;
LoadRSBModule(Target);
}
public bool LoadRSBModule(ReadOnlyTargetRules Target)
{
bool isLibrarySupported = false;
//bool bDebug = (Target.Configuration == UnrealTargetConfiguration.Debug && BuildConfiguration.bDebugBuildsActuallyUseDebugCRT);
if (Target.Platform == UnrealTargetPlatform.Win64)
{
isLibrarySupported = true;
string LibrariesPath = Path.Combine(ModulePath, "lib64");
//string PlatformString = (Target.Platform == UnrealTargetPlatform.Win64) ? "x64" : "x86";
Console.WriteLine("... LibrariesPath -> " + LibrariesPath);
Console.WriteLine("Test -> " + Path.Combine(LibrariesPath, "testfile"));
// Explicitly name the used libraries
PublicAdditionalLibraries.Add(Path.Combine(LibrariesPath, "boost_atomic-vc141-mt-1_65_1" + ".lib"));
PublicAdditionalLibraries.Add(Path.Combine(LibrariesPath, "boost_atomic-vc141-mt-gd-1_65_1" + ".lib"));
PublicAdditionalLibraries.Add(Path.Combine(LibrariesPath, "boost_chrono-vc141-mt-1_65_1" + ".lib"));
PublicAdditionalLibraries.Add(Path.Combine(LibrariesPath, "boost_chrono-vc141-mt-gd-1_65_1" + ".lib"));
... [more libs]
}
if (isLibrarySupported)
{
PublicIncludePaths.Add(Path.Combine(ModulePath, "include"));
Console.WriteLine("... IndlucePath -> " + Path.Combine(ModulePath, "include"));
// Not sure if needed
PublicDefinitions.Add("_CRT_SECURE_NO_WARNINGS=1");
PublicDefinitions.Add("BOOST_DISABLE_ABI_HEADERS=1");
// Needed configurations in order to run Boost
bUseRTTI = true;
bEnableExceptions = true;
//bEnableUndefinedIdentifierWarnings = false;
}
PublicDefinitions.Add(string.Format("WITH_RSB_BINDING={0}", isLibrarySupported ? 1 : 0));
PublicDefinitions.Add(string.Format("WITH_BOOST_BINDING={0}", isLibrarySupported ? 1 : 0));
return isLibrarySupported;
}
}
Is there anything I or the tutorial is missing?