# \[Unresolved external symbol\]

**URL:** <https://forums.unrealengine.com/t/unresolved-external-symbol/381582>\
**Category:** AI\
**Tags:** error, compiling, unresolved-external-, unreal-engine, question, CPP\
**Created:** [January 11, 2017, 10:11pm UTC](https://forums.unrealengine.com/t/unresolved-external-symbol/381582 "2017-01-11T22:11:49Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tengrichan](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Tengrichan](https://forums.unrealengine.com/u/Tengrichan)\
**Post date:** [January 11, 2017, 10:11pm UTC](https://forums.unrealengine.com/t/unresolved-external-symbol/381582/1 "2017-01-11T22:11:49Z")

</div>

Hello!

I have an already working game with BT,services,tasks.  
What i want to do is replicate these services,tasks,decorators in C++ so i can make them more customised and eventually want to use 3rd party libraries to process data in service(s) so i can try out myself with machine learning,neural networks.

So i decided to begin with simple stuff however i managed to hit a wall after looking for possible solutions to my problem but couldn’t figure out how to solve it based on the answers.

Anyway i just want to make a new task node in C++ that i could use in the editor as a building block.  
Here is the header file:

```
// Fill out your copyright notice in the Description page of Project Settings.

#pragma once

#include "BehaviorTree/BTTaskNode.h"
#include "MyBTTaskNodeTest1.generated.h"

UCLASS()
class MYPROJECT_API UMyBTTaskNodeTest : public UBTTaskNode
{
	GENERATED_BODY()

    virtual EBTNodeResult::Type ExecuteTask(UBehaviorTreeComponent& OwnerComp, uint8* NodeMemory) override;
	
};

```

Here i read some solutions suggested to include the myproject\_api part,then there was one where the generated\_body() part was something else so it had to be changed to the one i am already using.  
I started out the way it is now so that can’t be the problem afaik.

And the .cpp file:

```
// Fill out your copyright notice in the Description page of Project Settings.

#include "MyProject.h"
#include "MyBTTaskNodeTest.h"
#include "BehaviorTree/BlackboardComponent.h"
#include "Runtime/AIModule/Classes/AIController.h"
#include "Runtime/AIModule/Classes/Blueprint/AIBlueprintHelperLibrary.h"

EBTNodeResult::Type UMyBTTaskNodeTest::ExecuteTask(class UBehaviorTreeComponent & OwnerComp, uint8 * NodeMemory)
{
	//Get controller of the owner component
	AAIController* AICon = Cast<AAIController>(OwnerComp.GetAIOwner());

	//check if it's valid
	if (AICon == nullptr) 
	{
		return EBTNodeResult::Failed;
	}

	//check if the pawn is valid
	if (AICon->GetPawn() == nullptr)
	{
		return EBTNodeResult::Failed;
	}

	//If both valid get the blackboard component of the pawn
	AActor* Pawn = nullptr;
	UBlackboardComponent* BlackboardComp = nullptr;
	if (AICon && (AICon->GetPawn()) )
	{
		Pawn = AICon->GetPawn();
		BlackboardComp = UAIBlueprintHelperLibrary::GetBlackboard(Pawn);
	}

	//If the blackboard component is valid print out a text
	if (BlackboardComp) 
	{
		UE_LOG(LogTemp, Warning, TEXT("BlackBoardComponent successfully found!"));	
		return EBTNodeResult::Succeeded;
	}

	return EBTNodeResult::Type();
}

```

When i compile in VS it gives 0 errors or warnings and everything goes smooth!  
However when i try to compile in the Unreal Editor i get the following errors:  
CompilerResultsLog:Error: Error MyBTTaskNodeTest.cpp.obj : error LNK2001: unresolved external symbol “public: virtual void \_\_cdecl IGameplayTaskOwnerInterface::OnGameplayTaskActivated(class UGameplayTask &)” (?OnGameplayTaskActivated@IGameplayTaskOwnerInterface@@UEAAXAEAVUGameplayTask@@@Z)  
CompilerResultsLog:Error: Error MyProject.generated.cpp.obj : error LNK2001: unresolved external symbol “public: virtual void \_\_cdecl IGameplayTaskOwnerInterface::OnGameplayTaskActivated(class UGameplayTask &)” (?OnGameplayTaskActivated@IGameplayTaskOwnerInterface@@UEAAXAEAVUGameplayTask@@@Z)  
CompilerResultsLog:Error: Error C:\UE4\_Projects\MyProject\Binaries\Win64\UE4Editor-MyProject-4703.dll : fatal error LNK1120: 1 unresolved externals

I got similar errors before in VS because i didn’t include a header file but eventually solved them.However this time i don’t know what to do.  
So my questions:

1. What to do?I see what the error is but this is the first time i run  
into linker issues since i learned  
the basics of C++ with gcc with  
simple classes. So i am not familiar with troubleshooting especially in this case where it works in one enviroment but fails in another.

2. What can i do in the future to avoid  
problems like these?

3. What would be the best  
format,structure for my goal  
with deep learning?Is it good enough  
to use a service,process data in it  
then produce an output and based on that output run a task?

Also if there are suggestions regarding my coding feel free to tell them.(format,etc…).

---

<div class="post-metadata">

**Author:** ![Tengrichan](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Tengrichan](https://forums.unrealengine.com/u/Tengrichan)\
**Post date:** [January 12, 2017, 11:25am UTC](https://forums.unrealengine.com/t/unresolved-external-symbol/381582/2 "2017-01-12T11:25:20Z")

</div>

Solution:  
Had to include “GameplayTasks” in the build file even though “AIModule” was already included.

---

<div class="post-metadata">

**Author:** ![Crispy\_Penguin](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Crispy\_Penguin](https://forums.unrealengine.com/u/Crispy_Penguin)\
**Post date:** [July 17, 2017, 12:41pm UTC](https://forums.unrealengine.com/t/unresolved-external-symbol/381582/3 "2017-07-17T12:41:29Z")

</div>

You are the real MVP

---

<div class="post-metadata">

**Author:** ![nynpcc](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@nynpcc](https://forums.unrealengine.com/u/nynpcc)\
**Post date:** [October 28, 2017, 1:11pm UTC](https://forums.unrealengine.com/t/unresolved-external-symbol/381582/4 "2017-10-28T13:11:50Z")

</div>

In UE 4.17, It raise

> Severity Code Description Project File Line Suppression State  
> Error LNK2001 unresolved external symbol “public: virtual enum EBTNodeResult::Type \_\_cdecl \>UBTTargetPointSelection::ExecuteTask(class UBehaviorTreeComponent &,unsigned char \*)” (?\>ExecuteTask@UBTTargetPointSelection@@UEAA?\>AW4Type@EBTNodeResult@@AEAVUBehaviorTreeComponent@@PEAE@Z)

Any Idea?

I added AIModule and GameplayTask to PublicDependencyModuleNames, still not work.

---

<div class="post-metadata">

**Author:** ![Lobotomiac](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Lobotomiac](https://forums.unrealengine.com/u/Lobotomiac)\
**Post date:** [January 30, 2019, 12:27pm UTC](https://forums.unrealengine.com/t/unresolved-external-symbol/381582/5 "2019-01-30T12:27:11Z")

</div>

I’m having the same issue atm, 4.19 tho. Have you found a solution?
