Link thirdparty with .a to project

Hi.
I want to use the Boost library in my project for android. I got the .a of the Boost library. But i don’t know how to link it.Can anyone help me?

If you can tell me why Windows version of Boost prompts LNK error is better (Can not open file “xxxxx.lib”).

Hi there,

you have to add the third party lib to the project as a dependency. I will describe the way I do it in our project, where I link external static library (with multiple other runtime dependencies) to a plugin as a dependency.

In the root folder of the project, I have folder called deps with sub-folders include and lib. In the include sub-folder I have the .lib for the Windows and the .a for the OS X version of the project.

For the Windows version, you have to make sure you build the third party .lib in proper configuration - for Unreal Engine “Visual Studio 14 2015” 64 bit version will do.

The linking to the project is done in .Build.cs file. My .Build.cs file is located here:

ProjectDir/Plugins/PluginName/Source/ModuleName/ModuleName.Build.cs

BUT that is because I link the third party library as a dependency to the plugin. You will want to edit the .Build.cs here:

ProjectDir/Source/ProjectName/ProjectName.Build.cs and add some code to the function there.

First you need to determine the path to the deps folder - you can specify this path manually but because I develop is as a plugin that I need to be able to distribute to different project and computers, (just FYI) I get the path this way… First get the full path to the module directory:

string moduleDir = Path.GetFullPath(ModuleDirectory);

Then I parse out the the project directory path by cutting off the Plugins directory:

string projectDir = moduleDir.Substring(0, moduleDir.IndexOf("Plugins\\PluginName\\Source\\ModuleName"));

…and as a last step I append the folder name:

string dependencyFolder = Path.Combine(projectDir, "deps");

Now we can link the third party library. First add the folder with header files - they work as an API of the library and you will include those you need to your project.

PublicIncludePaths.Add(Path.Combine(dependencyFolder, "include"));

And now link the third party library:

PublicAdditionalLibraries.Add(Path.Combine(dependencyFolder, "thirdparty.lib"));

For Mac you can do the very same thing. If you don’t want to work with dynamic location of the project, just replace the dependencyFolder variable I use with real path to the deps directory in your project (something like: “C:\Project\deps”).

Good luck, hope this helps.

Very thank you for your answer, i solved this problem.
Do you know how to package with boost library?
I linked it to my project, and use it normally.
But if when i package with android settings, i got errors.
Like those:

220986-90hqw4sen.png

220987-15112820771.png

Or can you tell me how to Anti the data from the boost library serialization.

I’m going to be driven crazy, if you know any Serialization that can be run through the socket on Android, please tell me.
Forgive me for my poor English.