x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

[Unresolved external symbol]

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...).

Product Version: UE 4.13
Tags:
more ▼

asked Jan 11 '17 at 10:11 PM in C++ Programming

avatar image

Tengrichan
46 3 5 9

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

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

more ▼

answered Jan 12 '17 at 11:25 AM

avatar image

Tengrichan
46 3 5 9

avatar image Crispy_Penguin Jul 17 '17 at 12:41 PM

You are the real MVP

avatar image nynpcc Oct 28 '17 at 01:11 PM

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.

avatar image Lobotomiac Jan 30 '19 at 12:27 PM

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

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question