Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

Creating Plugin with .lib and .dll

Hey there, I'm trying to create a plugin that uses some third party libraries. I followed this tutorial to set my plugin up: http://www.valentinkraft.de/including-the-point-cloud-library-into-unreal-tutorial/ 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;
             new string[] {
                 // ... add public include paths required here ...
             new string[] {
                 // ... add other private include paths required here ...
             new string[]
                 // ... add other public dependencies that you statically link with here ...
             new string[]
                 // ... add private dependencies that you statically link with here ...    
             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;
     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
             // 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?

Product Version: UE 4.20
more ▼

asked May 14 '19 at 03:28 PM in Installation & Setup

avatar image

8 3 4 7

avatar image Fayre333 May 15 '19 at 11:39 AM

UPDATE: I have no idea if I'm right about that but I found out that usually the C4273 dll linkage error is a warning and that Unreal sometimes treats warning as errors. I can suppress this with #pragma warning(disable: 4273) but I don't know if this is smart. However, when I try to compile with the error supressed, I get this error:

 LINK : fatal error LNK1104: can not open file "xxxxx.lib"

I don't know if there is something wrong with the path to this file, but I think not (I'm printing the include path and it is right). Does anyone have any experiences with this? I don't really know where to look for answers...

avatar image DebashishPatra May 18 '19 at 06:48 AM

Okay, lets break this down. There are following ways to implement dll/lib paired files.

  1. DLL with LIB.
    • Engine statically links to all functions

    • You have to use UBT to set things up

    • Your libraries are not exposed to end user

    • Linking is mendatory. Any missing references will throw error.

  2. DLL without LIB
    • Your code has function pointers

    • You have to use manually set things up

    • Your libraries are exposed to end user

    • Linking is optional. Any missing references will just continue the operation.

So, which one are planning to use ?

avatar image Fayre333 May 19 '19 at 10:18 AM

Thanks for your answer! I guess I have to go for the first way. The library I want to use in my plugin consists of libs, dlls and header files. If I am correct, I want to include the header files that are then using functions from the dll and lib files. I have found the following for linking dlls:


And that you can do something like this in your plugin's cpp file:

 DLLHandle = FPlatformProcess::GetDllHandle(*filePath);

But even with the PublicDelayLoadDLLs I am still getting this error. And since the DllHandle is in my cpp file and will be called in the ModuleStartup method I don't think that this would solve my compile error. Am I right with this?

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

0 answers: sort voted first
Be the first one to answer this question
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question