Download

Lnk2001

Bottom Line Up Front: I am using VS2017, the thirdperson C++ template, and am getting linker errors. I basically copied the entire crouch code in order to add prone as a movement funciton. Almost all of my edits took place the character.h/character.cpp. All of my new prone functions return linker error2001, I have spent over 6 hours trying to fix this…

I have tried everything with this error. I have:

  1. Deleted all of the folders in my game directory except source and config.
  2. Generated a new .sln
  3. did a full rebuild
  4. switched the solution configuration
  5. reinstalled VS2017…

I feel like I am missing something simple, because this shouldn’t be that hard…

Again, ALL I did was copy the crouch code and rename everything to prone to start off…

Please HELP!!!

Here is the error log:


Log file open, 02/16/18 17:52:12
LogInit:Display: Running engine for game: ShooterGame
LogPlatformFile: Not using cached read wrapper
LogInit:Display: RandInit(-1561672412) SRandInit(-1561672412).
LogTaskGraph: Started task graph with 5 named threads and 8 total threads with 1 sets of task threads.
LogStats: Stats thread started at 0.090032
LogInit:Warning: Incompatible or missing module: UE4Editor-ShooterGame.dll
Running C:/Program Files/Epic Games/UE_4.16/Engine/Binaries/DotNET/UnrealBuildTool.exe ShooterGame Development Win64 -project="C:/Users/Cinco/Documents/Unreal Projects/ShooterGame/ShooterGame.uproject" -editorrecompile -progress -NoHotReloadFromIDE
@progress push 5%
@progress pop
Performing 2 actions (4 in parallel)
[1/2] Link UE4Editor-ShooterGame.dll
[2/2] Link UE4Editor-ShooterGameLoadingScreen.dll
   Creating library C:\Users\Cinco\Documents\Unreal Projects\ShooterGame\Intermediate\Build\Win64\UE4Editor\Development\UE4Editor-ShooterGameLoadingScreen.suppressed.lib and object C:\Users\Cinco\Documents\Unreal Projects\ShooterGame\Intermediate\Build\Win64\UE4Editor\Development\UE4Editor-ShooterGameLoadingScreen.suppressed.exp
   Creating library C:\Users\Cinco\Documents\Unreal Projects\ShooterGame\Intermediate\Build\Win64\UE4Editor\Development\UE4Editor-ShooterGame.suppressed.lib and object C:\Users\Cinco\Documents\Unreal Projects\ShooterGame\Intermediate\Build\Win64\UE4Editor\Development\UE4Editor-ShooterGame.suppressed.exp
Module.ShooterGame.cpp.obj : error LNK2001: unresolved external symbol "public: virtual bool __cdecl ACharacter::CanProne(void)" (?CanProne@ACharacter@@UEAA_NXZ)
ShooterGame.generated.1.cpp.obj : error LNK2001: unresolved external symbol "public: virtual bool __cdecl ACharacter::CanProne(void)" (?CanProne@ACharacter@@UEAA_NXZ)
Module.ShooterGame.cpp.obj : error LNK2001: unresolved external symbol "public: virtual bool __cdecl UCharacterMovementComponent::CanProneInCurrentState(void)const " (?CanProneInCurrentState@UCharacterMovementComponent@@UEBA_NXZ)
ShooterGame.generated.1.cpp.obj : error LNK2001: unresolved external symbol "public: virtual bool __cdecl UCharacterMovementComponent::CanProneInCurrentState(void)const " (?CanProneInCurrentState@UCharacterMovementComponent@@UEBA_NXZ)
Module.ShooterGame.cpp.obj : error LNK2001: unresolved external symbol "public: virtual bool __cdecl UCharacterMovementComponent::IsProneing(void)const " (?IsProneing@UCharacterMovementComponent@@UEBA_NXZ)
ShooterGame.generated.1.cpp.obj : error LNK2001: unresolved external symbol "public: virtual bool __cdecl UCharacterMovementComponent::IsProneing(void)const " (?IsProneing@UCharacterMovementComponent@@UEBA_NXZ)
Module.ShooterGame.cpp.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl ACharacter::OnEndProne(float,float)" (?OnEndProne@ACharacter@@UEAAXMM@Z)
ShooterGame.generated.1.cpp.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl ACharacter::OnEndProne(float,float)" (?OnEndProne@ACharacter@@UEAAXMM@Z)
Module.ShooterGame.cpp.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl ACharacter::OnRep_IsProned(void)" (?OnRep_IsProned@ACharacter@@UEAAXXZ)
ShooterGame.generated.1.cpp.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl ACharacter::OnRep_IsProned(void)" (?OnRep_IsProned@ACharacter@@UEAAXXZ)
Module.ShooterGame.cpp.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl ACharacter::OnStartProne(float,float)" (?OnStartProne@ACharacter@@UEAAXMM@Z)
ShooterGame.generated.1.cpp.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl ACharacter::OnStartProne(float,float)" (?OnStartProne@ACharacter@@UEAAXMM@Z)
Module.ShooterGame.cpp.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl ACharacter::Prone(bool)" (?Prone@ACharacter@@UEAAX_N@Z)
ShooterGame.generated.1.cpp.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl ACharacter::Prone(bool)" (?Prone@ACharacter@@UEAAX_N@Z)
Module.ShooterGame.cpp.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl UCharacterMovementComponent::Prone(bool)" (?Prone@UCharacterMovementComponent@@UEAAX_N@Z)
ShooterGame.generated.1.cpp.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl UCharacterMovementComponent::Prone(bool)" (?Prone@UCharacterMovementComponent@@UEAAX_N@Z)
Module.ShooterGame.cpp.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl ACharacter::UnProne(bool)" (?UnProne@ACharacter@@UEAAX_N@Z)
ShooterGame.generated.1.cpp.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl ACharacter::UnProne(bool)" (?UnProne@ACharacter@@UEAAX_N@Z)
Module.ShooterGame.cpp.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl UCharacterMovementComponent::UnProne(bool)" (?UnProne@UCharacterMovementComponent@@UEAAX_N@Z)
ShooterGame.generated.1.cpp.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl UCharacterMovementComponent::UnProne(bool)" (?UnProne@UCharacterMovementComponent@@UEAAX_N@Z)
C:\Users\Cinco\Documents\Unreal Projects\ShooterGame\Binaries\Win64\UE4Editor-ShooterGame.dll : fatal error LNK1120: 10 unresolved externals
ERROR: UBT ERROR: Failed to produce item: C:\Users\Cinco\Documents\Unreal Projects\ShooterGame\Binaries\Win64\UE4Editor-ShooterGame.dll
Total build time: 2.73 seconds (Local executor: 0.00 seconds)
LogInit:Warning: Still incompatible or missing module: UE4Editor-ShooterGame.dll
LogExit: Preparing to exit.

And here is an exmple function definition from the character.h file:


virtual bool CanProne();

And the actual function from the Character.cpp file:


bool ACharacter::CanProne()
{
    return !bIsProned && CharacterMovement && CharacterMovement->CanEverProne() && GetRootComponent() && !GetRootComponent()->IsSimulatingPhysics();
}

So I suspected this was a cache issue. Turns out the “virtual void” functions were causing all of the issues, and I have no idea why.