I have a question about linking a static library to a UE4 project. I looked at a lot of documentation on this but there is no demo / tutorial. Most of the time, these are just forums that talk about issues. The recent wiki shutdown doesn’t help as a lot of people are talking about a tutorial link that no longer exists. Do you know where I can find a tutorial to help me? This link is deprecated:
For information, I have the *.lib and *.h of another project that I would like to link to my UE4 project (4.24.3). I have tried generating a ThirdParty plugin with the editor builder, but I can’t seem to call the default auto-create function. The inclusion of .h is not done.
Thank you for reading me, I only need to know the steps to follow in order to properly link my static library to my project.
Thank you very much, it is a valuable job that you have done. However regarding my problem, I have not found a solution for the static libraries to link to a game project. You have referenced a guide to add a library to the engine directly, but it is incomplete.
In my case this solved issue (in MyPlugin.Build.cs)
using System.IO; using System.Text.RegularExpressions; using UnrealBuildTool; public class MyPlugin: 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/")); } } public MyPlugin(ReadOnlyTargetRules Target) : base(Target) { PCHUsage = ModuleRules.PCHUsageMode.UseExplicitOrSharedPCHs; PublicAdditionalLibraries.Add(Path.Combine(ThirdPartyPath, "openh264/lib/openh264.lib")); PublicIncludePaths.Add(Path.Combine(ThirdPartyPath, "openh264/include")); PublicIncludePaths.AddRange( new string[] { // ... add public include paths required here ... } ); PrivateIncludePaths.AddRange( new string[] { // ... add other private include paths required here ... } ); PublicDependencyModuleNames.AddRange( new string[] { "Core", "InputCore", // ... add other public dependencies that you statically link with here ... } ); 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 ... } ); } }