Why can't I override Tick in my GameMode?

Hi, guys! :slight_smile:

Currently, i got stuck with a very strange problem: I cant override the tick function on a game mode-derivated class, even though i can do it on different projects, and of course on different classes in the same project.

I get this error output:

CompilerResultsLog:Error: Error MyGameMode.cpp.obj : error LNK2001: unresolved external symbol “private: virtual void __cdecl AMyGameMode::Tick(float)” (?Tick@AMyGameMode@@EEAAXM@Z)

CompilerResultsLog:Error: Error MyProject.generated.cpp.obj : error LNK2001: unresolved external symbol “private: virtual void __cdecl AMyGameMode::Tick(float)” (?Tick@AMyGameMode@@EEAAXM@Z)

CompilerResultsLog:Error: Error C:\Users\Documents\Unreal Projects\MyProject\Binaries\Win64\UE4Editor-MyProject-9639.dll : fatal error LNK1120: 1 unresolved externals

It seems it’s a linker error, however, even though I checked and re-checked the #inclusions, i am still not able to understood where the problem is.

Sorry for my english, and thanks in advance for any reply!

Might be a simple syntax problem. Could you please post your Tick declaration and definition? Or, at least the beginning of the definition.

Your English is fine :slight_smile:

This error can happen if the compiler does not detect a function you define in your .h. Like clt2488 said, maybe providing the definition/declaration will help solving your problem! :slight_smile:

Tick override should be public not private, also check if you added “override” in decleration

My function declaration is “virtual void Tick(float DelatSeconds) override;”,and is under private. Even though in AGameMode.h the tick function is declared under public:, it’s not a problem if I override it on the private or protected section of MyGameMode subclass, since in c++ an inherited function can be overrided under all visibility specifiers that have an higher data protection/encapsulation (As example, public—>private/protected = OK, private/protected---->public = Error).

However, i finally found a solution to my error in a similar question: Unresolved external Symbol when implementing DetourCrowds - C++ - Epic Developer Community Forums
I followed the compiler errors link of that guy and looked at the 52th compiler output:

Error 52 error LNK2001: unresolved external symbol “public: virtual void __cdecl AAIController::Tick(float)” (?Tick@AAIController@@UEAAXM@Z)

He have had my same exact problem, the solution was adding “AIModule” in the MyGameBuild .cs file: PublicDependencyModuleNames.AddRange(new string[] { “Core”, “CoreUObject”, “Engine”, “InputCore”,
—>“AIModule”<— });

1 Like