What It Means & How to Fix It in UE5
🧠 Why You’re Seeing This Error
This error means the linker was expecting to find a function or variable definition from a third-party library (like a .lib
or .dll
), but it wasn’t able to resolve it.
So your code is calling something like LibraryFunction()
, but the linker can’t find where that function actually lives — because the required library:
- Isn’t linked properly in your
.Build.cs
file - Isn’t included in your
PublicAdditionalLibraries
- Is compiled with incompatible settings
- Is missing altogether from your include or lib folders
💥 Example Error Message
LNK2019: unresolved external symbol "void __cdecl MyExternalFunction()" referenced in function "main"
Or:
Unresolved external symbol _MyThirdPartyFunction referenced in module MyModule.cpp.obj
🛠️ What Usually Causes This
❌ You Declared a Function, but Didn’t Link Its Implementation
// You called a function in a third-party lib
MyLib::DoSomething(); // ❌ But Unreal doesn’t know where that implementation is
❌ The .lib
File Isn’t Being Linked
Even if you included the headers, Unreal still needs to know which .lib
to link against in your .Build.cs
.
❌ You Added the Headers But Not the Library
// Included:
PublicIncludePaths.Add(Path.Combine(LibPath, "include")); // ✅
// Missing:
PublicAdditionalLibraries.Add(Path.Combine(LibPath, "lib", "MyLib.lib")); // ❌
❌ You’re Linking the Wrong Platform or Configuration Version
Linking a Win64 library on Win32? Or a Debug library in a Shipping build? That’ll break it too.
✅ How to Fix It – Step-by-Step
✔️ 1. Include the Third-Party .lib
File in .Build.cs
In your module’s .Build.cs
:
string ThirdPartyPath = Path.Combine(ModuleDirectory, "../../ThirdParty/MyLib");
PublicIncludePaths.Add(Path.Combine(ThirdPartyPath, "include"));
PublicAdditionalLibraries.Add(Path.Combine(ThirdPartyPath, "lib", "MyLib.lib"));
✅ Make sure paths are absolute or built from ModuleDirectory
✅ Use System.IO.Path.Combine()
for safe cross-platform path building
✔️ 2. Match the Library to the Build Configuration
If you’re building in Debug:
PublicAdditionalLibraries.Add("MyLib_Debug.lib");
Or conditionally:
if (Target.Configuration == UnrealTargetConfiguration.Debug)
{
PublicAdditionalLibraries.Add("MyLib_Debug.lib");
}
else
{
PublicAdditionalLibraries.Add("MyLib.lib");
}
✔️ 3. Check for C++ Function Name Mangling
If the third-party library is C-based and you’re using it in C++, wrap the declarations like so:
extern "C"
{
void MyCFunction(); // prevents name mangling
}
Or confirm the .lib
matches your calling convention and language expectations.
✔️ 4. Double-Check Platform Compatibility
Make sure the .lib
is built for your target platform:
- Win64 for UE on Windows
- x86 vs x64 mismatch
- ARM vs x64 (for mobile targets)
✔️ 5. Clean and Rebuild the Project
Sometimes stale builds cause this error to stick around:
Delete: Binaries/, Intermediate/
→ Regenerate project files
→ Rebuild the project from scratch
✅ Summary: How to Fix “Unresolved External Symbol from Third-Party Library” in UE5
Cause | Fix |
---|---|
.lib not linked in .Build.cs | Add PublicAdditionalLibraries.Add() with full path |
Headers included but not implementation | Link both headers and compiled library |
Platform or config mismatch | Use correct lib for Debug/Release and Win64/ARM |
Missing extern "C" for C linkage | Wrap declarations to prevent C++ name mangling |
Wrong file structure or stale cache | Rebuild, clean, and verify folder layout |