I have a solution. The reason for this is error is your complete wrong way of including third party libraries in your game’s code. Had a similar problem before and it took me some time to sort it out (A new, community-hosted Unreal Engine Wiki - Announcements - Epic Developer Community Forums, Source Build Errors - Programming & Scripting - Epic Developer Community Forums - were the most useful links). I will try to describe process and also upload archive with files.
- Compile your 3d party code into a lib for x64.
- Create ThirdParty folder in your project folder (MyProject, etc).
- Create the following folder structure:
sqlite3/include/ -> put .h files here
sqlite3/lib/x64 -> put your compiled lib files here
Now comes the tricky part. We must inform UBT to use our ThirdParty folder as an additional source of includes and libraries.
4. Open your <project_name>.Build.cs (in my case, MyProject.Build.cs)
5. after
using UnrealBuildTool;
add
using System.IO;
- add two helper functions to the existing class:
private string ModulePath
{
get { return Path.GetDirectoryName(RulesCompiler.GetModuleFilename(this.GetType().Name)); }
}
private string ThirdPartyPath
{
get { return Path.GetFullPath(Path.Combine(ModulePath, "../../ThirdParty/")); }
}
- In MyProject function, add the following at the end:
LoadSqlite3(Target);
- add additional function to a class:
public bool LoadSqlite3(TargetInfo Target)
{
bool isApplied = false;
if ((Target.Platform == UnrealTargetPlatform.Win64))
{
isApplied = true;
string LibraryPath = Path.Combine(ThirdPartyPath, "sqlite3", "lib");
//string LibraryName = "sqlite3";
if (Target.Platform == UnrealTargetPlatform.Win64)
{
LibraryPath = Path.Combine(LibraryPath, "x64");
}
PublicLibraryPaths.Add(LibraryPath);
PublicAdditionalLibraries.Add(Path.Combine(LibraryPath, "sqlite3.lib"));
PublicIncludePaths.Add(Path.Combine(ThirdPartyPath, "sqlite3", "include"));
}
return isApplied;
}
As you can see I use only Win64 but if you need more platforms, feel free to compile 'em and add to if/else if in LoadSqlite3 function. You can see different platforms, for example, here: \Engine\Source\ThirdParty\zlib\zlib.Build.cs
#include "sqlite3.h"
add this line to file where you want to use sqlite3.
That’s all, hope this helps.
Forgot to add uploaded archive: http://uploaded.net/file/spdnoyj0. Folder structure for third party code (in our case - sqlite3) + example build file
Oh, and a friendly advice for Shoiko, try to use containers which are provided by UE and don’t mess with STL