# Is there a specific library necessary to use static functions?

**URL:** <https://forums.unrealengine.com/t/is-there-a-specific-library-necessary-to-use-static-functions/480345>\
**Category:** C++\
**Tags:** function-library, linker-error, unreal-engine, question, CPP\
**Created:** [March 15, 2021, 4:41pm UTC](https://forums.unrealengine.com/t/is-there-a-specific-library-necessary-to-use-static-functions/480345 "2021-03-15T16:41:54Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous\_user\_44809d39](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_44809d39](https://forums.unrealengine.com/u/anonymous_user_44809d39)\
**Post date:** [March 15, 2021, 4:41pm UTC](https://forums.unrealengine.com/t/is-there-a-specific-library-necessary-to-use-static-functions/480345/1 "2021-03-15T16:41:54Z")

</div>

So I’m trying to use a static function so that i can add it to a function library via c++ my code is as follows:

in the header file:

under the public section:

static bool CanSeeActor(const UWorld\* World, FVector Location, const AActor\* TargetActor, TArray IgnoreActors = TArray());

in in the cpp file:

static bool CanSeeActor(const UWorld\* World, FVector Location, const AActor\* TargetActor, TArray IgnoreActors = TArray())  
{  
my implementation  
}

when i went to compile i was getting a linker error but I am not sure how to resolve it:

Severity Code Description Project File Line Suppression State  
Error LNK2019 unresolved external symbol “public: static bool \_\_cdecl UDodgeballFunctionLibrary::CanSeeActor(class UWorld const \*,struct FVector,class AActor const \*,class TArray\<class AActor const \*,class TSizedDefaultAllocator\<32\> \>)” (?CanSeeActor@UDodgeballFunctionLibrary@@SA\_NPEBVUWorld@@UFVector@@PEBVAActor@@anonymous_user_e71e0d8a1?$TArray@PEBVAActor@@anonymous_user_e71e0d8a1?$TSizedDefaultAllocator@$0CA@@@@@@Z) referenced in function “public: bool \_\_cdecl AEnemyCharacter::LookAtActor(class AActor \*)” (?LookAtActor@AEnemyCharacter@@QEAA\_NPEAVAActor@@@Z) Dodgeball C:\Users\OneDrive\Desktop\C++ Projects\DodgeballUE4\Dodgeball\Intermediate\ProjectFiles\EnemyCharacter.cpp.obj 1

Am i missing something?

---

<div class="post-metadata">

**Author:** ![Grim\_1](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/grim_1/32/88715_2.png) [@Grim\_1](https://forums.unrealengine.com/u/Grim_1)\
**Post date:** [March 15, 2021, 6:59pm UTC](https://forums.unrealengine.com/t/is-there-a-specific-library-necessary-to-use-static-functions/480345/2 "2021-03-15T18:59:26Z")

</div>

You used your CanSeeActor function in AEnemyCharacter::LookAtActor without having included the definition in that translation unit.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_44809d39](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_44809d39](https://forums.unrealengine.com/u/anonymous_user_44809d39)\
**Post date:** [March 16, 2021, 3:13pm UTC](https://forums.unrealengine.com/t/is-there-a-specific-library-necessary-to-use-static-functions/480345/3 "2021-03-16T15:13:22Z")

</div>

Thanks for the response! You helped me figure it out. 🙂

---

<div class="post-metadata">

**Author:** ![Grim\_1](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/grim_1/32/88715_2.png) [@Grim\_1](https://forums.unrealengine.com/u/Grim_1)\
**Post date:** [March 16, 2021, 10:36pm UTC](https://forums.unrealengine.com/t/is-there-a-specific-library-necessary-to-use-static-functions/480345/4 "2021-03-16T22:36:22Z")

</div>

good to hear, please mark answers as accepted when they have helped you solve your problem.
