I never figured out my last linker problem on the Mac, but I’m experiencing a similar, but different one now. I have a class - subclass of [FONT=Courier New]ACharacter - that works fine, until I try to add this function
FString AEnemyCharacter::AlertStatusString()
{
EEnemyAlertStatus::Type AlertStatus = GetAlertStatus();
return GetNameForAlertStatus(AlertStatus);
}
The actual contents of the function don’t seem to matter - I replaced it with [FONT=Courier New]return TEXT(“Test”); and I got the same error.
Actually adding the member function to the .cpp file doesn’t trigger the error. It’s not until I add the declaration to the .h file that it stops building.
/** Returns a string representing the character's current alert status */
UFUNCTION(BlueprintCallable, Category=Alertness)
FString AlertStatusString();
The error I’m getting is:
xternalBuildToolExecution RepublicSniperAIEditor\ -\ Mac
cd /Users/Shared/UnrealEngine/4.4
export ACTION=
/Users/Shared/UnrealEngine/4.4/Engine/Build/BatchFiles/Mac/RocketBuild.sh RepublicSniperAIEditor macosx DebugGame /Users//Dropbox\ (MartianCraft)/RepublicSniperAI/RepublicSniperAI.uproject
Building RepublicSniperAIEditor...
Compiling with Mac SDK 10.9
Parsing headers for RepublicSniperAIEditor
Reflection code generation finished for RepublicSniperAIEditor and took 3.721
Performing 8 actions (max 8 parallel jobs)
[3/8] Compile EnemyCharacter.cpp
[4/8] Compile RepublicSniperAI.generated.cpp
[5/8] Compile BaseNPCCharacter.cpp
[6/8] Compile FriendController.cpp
[2/8] Compile EnemyController.cpp
[7/8] Compile FriendCharacter.cpp
[1/8] Compile BaseNPCController.cpp
[8/8] Link UE4Editor-RepublicSniperAI-Mac-DebugGame.dylib
Undefined symbols for architecture x86_64:
"AEnemyCharacter::AlertStatusString()", referenced from:
AEnemyCharacter::execAlertStatusString(FFrame&, void*) in RepublicSniperAI.generated.cpp.o
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, 37.33 compiling, 0.00 creating app bundles, 0.00 generating debug info, 0.12 linking, 0.00 other
UBT execution time: 13.22 seconds
Command /Users/Shared/UnrealEngine/4.4/Engine/Build/BatchFiles/Mac/RocketBuild.sh failed with exit code 2
I suspect that the problem may actually be somewhere else and not in this method (despite the fact that it compiles successfully without this one method). Here’s the entire class along with its superclass (which descends from [FONT=Courier New]ACharacter):
I’m pulling my hair out over this - been stuck in my track for several days, so if anyone can help me figure out what boneheaded thing I’m doing, I’d very much appreciate it.
I’ve also asked on AnswerHub, and have put the entire project in the answer if anyone wants to just download it and try it out:
Entire project for download (Warning - 750 megs):
Thank you!