How do I add thirdparty library?

Hello there,

I want to add a Third Party Library to my project but I dont realy know HOW! …

Ive found [Static Libraries Using The Build System ][1] , but I dont know what I must do know.

The thirdparty library, which I want to add is MySQL.

According to the [MySQL Document][2] I need to add the library to the Linker in Visual Studio, but there is no Linker. In the german unrealengine4 forum someone wrote to me that Unreal Engine 4 dont use this settings from Visual Studio and I need to add the library manually.

Can someone help me out here?

40412-includecpp.png

The article (Static Libraries Using The Build System) shows exactly how to add you third-party *.lib in a UE4 project and corresponding include directories through the C# project build (no need to include them in VS project settings). You can link to your mysqlclient.lib and include directories from there. Have you tried it ?

Have a look at this other answer to the same question.

That wiki help page is very unhelpful.

The tldr; is, in your Project.Build.cs, you need to add:

PublicIncludePaths.Add('AbsolutePath/to/include/files');
PublicAdditionalLibraries.Add('AbsolutePath/to/mylib.dll');

You can use the various C# methods (eg.

var base_path = Path.GetFullPath(Path.Combine(Path.GetDirectoryName(RulesCompiler.GetModuleFilename(this.GetType().Name)), "../../mysql"));
var includes = Path.Combine(base_path, "include");

To generate the required absolute paths.

To be fair, that is the most useless wiki page on the site. It tells you almost absolutely nothing about how the linking works, doesn’t have a complete example, and links to the a UE4 plugin (ie. V8) that uses a different method to link it’s libraries.

Somehow in the newest UE4 Target.cs files, there is no reference to those Public* variables in the TargetRules context… Those are available in ModuleRules structure but how and where?

Check the answer below the accepted answer here: Can't build plugin in UE 4.12 - Platform & Builds - Epic Developer Community Forums

From years into the future: Thank you so, so, so much for this answer. I’ve tried searching for this multiple times in the past and finally - finally! - I understand how this works and what I next need to figure out.

Feels really good to finally get past this, so truly thank you from the bottom of my heart