# LINK ERROR when using plugin

**URL:** <https://forums.unrealengine.com/t/link-error-when-using-plugin/378680>\
**Category:** Plugins\
**Tags:** unreal-engine, link, Plugins, UE4, CPP, question\
**Created:** [December 8, 2016, 9:49am UTC](https://forums.unrealengine.com/t/link-error-when-using-plugin/378680 "2016-12-08T09:49:22Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous\_user\_4cbe2236](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_4cbe2236](https://forums.unrealengine.com/u/anonymous_user_4cbe2236)\
**Post date:** [December 8, 2016, 9:49am UTC](https://forums.unrealengine.com/t/link-error-when-using-plugin/378680/1 "2016-12-08T09:49:22Z")

</div>

Using the engine plugin, I created the object in the plugin compiler after the LINK ERROR, I like the following use：

```
PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore", "UObjectPlugin" });

```

And then create an instance of the plug-in that inherits from UObject：

```
#include "TestNullProject.h"
#include "TestNullProjectGameMode.h"
#include "MyPluginObject.h"

void ATestNullProjectGameMode::StartPlay()
{
	Super::StartPlay();

    UMyPluginObject* MyPluginObject = NewObject<UMyPluginObject>();    
}

```

LINKERROR appears at compile time：

```
2>TestNullProjectGameMode.cpp.obj : error LNK2019: unresolved external symbol "private: static class UClass * __cdecl UMyPluginObject::GetPrivateStaticClass(wchar_t const *)" (?GetPrivateStaticClass@UMyPluginObject@@CAPEAVUClass@@PEB_W@Z)，referenced in function "class UMyPluginObject *__cdecl NewObject<class UMyPluginObject>(class UObject *)" (??$NewObject@VUMyPluginObject@@@@YAPEAVUMyPluginObject@@PEAVUObject@@@Z) 
2>D:\Unreal Projects\TestNullProject\Binaries\Win64\UE4Editor-TestNullProject-6519.dll : fatal error LNK1120: 1 unresolved externals
2>ERROR : UBT error : Failed to produce item: D:\Unreal Projects\TestNullProject\Binaries\Win64\UE4Editor-TestNullProject-6519.dll

```

use it with wrong way?

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_4cbe2236](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_4cbe2236](https://forums.unrealengine.com/u/anonymous_user_4cbe2236)\
**Post date:** [December 10, 2016, 4:05pm UTC](https://forums.unrealengine.com/t/link-error-when-using-plugin/378680/2 "2016-12-10T16:05:48Z")

</div>

Ok, solved this:

In MyProject.build.cs I added the following lines:

```
PrivateDependencyModuleNames.AddRange(new string[] { "UObjectPlugin" });
PrivateIncludePathModuleNames.AddRange(new string[] { "UObjectPlugin" });

```

And then in the file which wanted to use this custom mesh component it was enough to include it like this:

```
#include "MyPluginObject.h"

```
