UE5 LNK2001 unresolved external symbol Solution

Advertisement

Here’s how to solve unreal engine unresolved external symbol error:

LNK2001 error is thrown by Visual Studio Linker after the developer has attempted to inherit from or use a class that’s not in the module dependency list. It is a C++ Linker error meaning that the linker failed to find either the .cpp or .obj needed to link. The developer has to make sure to include all the modules containing the code that is referenced by his CPP files. Follow this simple step-by-step tutorial to solve it.

Example Error Line.

LNK2001 unresolved external symbol “public: virtual enum EMovieSceneServerClientMask __cdecl UMovieSceneSequence::OverrideNetworkMask(enum EMovieSceneServerClientMask)const … etc.

This tutorial also applies for Error LNK2019 

How to solve it

  1. Read Error Code To Get The Class Causing The Error

UE5 LNK2001 Error Solution Step 1

The unreal engine unresolved external symbol error usually contains a class name followed by the function the Linker can’t find. In this unreal engine tutorial, we are mostly interested in the class.  Copy it and follow on. I have highlighted the class in our example error.  These errors seem cryptic at first encounter. You just need to know where to look and ignore the rest. In some cases, only the function is reported without the class. That is still fine, we can use that too.

  1. Locate the class in the unreal engine documentation

Most of the time, googling the class will lead you straight to the documentation page about the class on the unreal engine website. What we are looking for in the documentation page is the module name that this class belongs to. Googling the class is the fastest and easiest way I recommend to find the class. In our example we would be searching for  “UMovieSceneSequence” 

Sometimes though, rarely, you will not be able to find through Google or website. What you can do, is use the Find in Files Function of visual studio and search for the Class definition. We are interested in the header file where this class is defined. 

UE5 LNK2001 How to use Find In Files for class
  1. Find the module in the unreal engine documentation

At this point, you are either on the documentation page of the class or on the header file. We need to spot and copy the module name from here. 

On the documentation page/website the module we need to add to the build path is usually listed under “References”. In our example, we determined the missing module’s name to be MovieScene See the image below:.

UE5 How to locate class module on documentation page

Alternatively, If you’re on the header file, all you need to do is look at the on-disk path of the header file. The name we need is usually what appears after “Engine/Source/Runtime/”. See the image below:

UE5 LNK2001 How to find required module
  1. Add the module to the project’s Build.cs file

Final Step: We copy the module name and it to the PrivateDependencyModuleNames. Here is an example entry.

 

PrivateDependencyModuleNames.AddRange(new string[] { “LevelSequence” , “MovieScene” });

 

At this point you may be wondering what’s the difference between UE5 PrivateDependencyModuleNames and the PublicDependencyModuleNames. You can learn more about the difference in our Plugin Development Course.

That Should be it. Now when you rebuild the unreal engine unresolved external symbol error will be solved. If it doesn’t read the note about classes that use MinimalAPI

UCLASS WITH MINIMAL API

You might also encounter the unresolved external symbol error if you inherit from a class that usess UCLASS(MinimalAPI) specifier.

Classes with this specifier are generally not meant to be inherited. So the advice is to wrap the class as an object…

Alternatively you can edit the source and remove the “MinimapAPI” specifier but wouldn’t recommend it.

5/5

Gamechanger plugin for notehighway rhythm games and music visualizers

5/5

Add Text and 2D UMG widgets to Level Sequences

Consider investing in some of our plugins. They might save you some time.  Also helps supports these tutorials.

Instantly get access to our plugins like Blender Curves Importer and UMG Cinematics and more when  you support us on Patreon!

 Join Us On Discord For More Daily Tips!