I’m getting a compile error that’s making me pull my hair out. I suspect it’s something simple, but I can’t seem to figure it out.
I have a subclass of [FONT=Courier New]ACharacter called [FONT=Courier New]ABaseNPCCharacter, which has a lot of generic code to determine things like LOS, nearby friend and enemies, etc.
There are two subclasses of ABaseNPCCharacter ([FONT=Courier New]AEnemyCharacter and [FONT=Courier New]AFriendCharacter), but as of right now they are empty subclasses except they add a tag to the Actor’s [FONT=Courier New]Tag array.
All was well until I went to override [FONT=Courier New]PostInitializeComponents() in [FONT=Courier New]ABaseNPCCharacter.
I added this to ABaseNPCCharacter.h:
virtual void PostInitializeComponents() override;
and this to ABaseNPCCharacter.cp:
void ABaseNPCCharacter::PostInitializeComponents()
{
Super::PostInitializeComponents();
if (WaypointAutoBuildTag != NULL)
{
// TODO: Build waypoint array from tag
}
}
Basically, just a stub for future functionality. When I go to compile, I get this result, though;
[11/11] Link UE4Editor-RepublicSniperAI-Mac-DebugGame.dylib
Undefined symbols for architecture x86_64:
"ABaseNPCCharacter::PostInitializeComponents()", referenced from:
vtable for AEnemyCharacter in EnemyCharacter.cpp.o
vtable for AFriendCharacter in FriendCharacter.cpp.o
"vtable for ABaseNPCCharacter", referenced from:
ABaseNPCCharacter::ABaseNPCCharacter(FPostConstructInitializeProperties const&) in BaseNPCCharacter.cpp.o
ABaseNPCCharacter::~ABaseNPCCharacter() in EnemyCharacter.cpp.o
ABaseNPCCharacter::~ABaseNPCCharacter() in FriendCharacter.cpp.o
NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
-------- End Detailed Actions Stats -----------------------------------------------------------
ERROR: UBT ERROR: Failed to produce item: /Users//Dropbox (MartianCraft)/RepublicSniperAI/Binaries/Mac/UE4Editor-RepublicSniperAI-Mac-DebugGame.dylib
Cumulative action seconds (8 processors): 0.00 building projects, 55.85 compiling, 0.00 creating app bundles, 0.00 generating debug info, 0.17 linking, 0.00 other
UBT execution time: 14.11 seconds
Command /Users/Shared/UnrealEngine/4.4/Engine/Build/BatchFiles/Mac/RocketBuild.sh failed with exit code 2
I’ve tried a bunch of permuatations, including also adding overrides to the child classes, but nothing seems to get rid of this message. I’ve very confused, because neither AFriendCharacter or AEnemyCharacter implements a destructor.
Please, if anyone knows what boneheaded thing I’m doing here, I’d love to be pointed in the right direction.
Thanks!