Trying to learn how to get property replication working in C++, but having problems.
Steps to reproduce:
- In GUI, create new C++ subclass of Actor
- Add in anything and tag it with UPROPERTY(Replicated)
- Compile fails with error below
Info Running Mono... Info Info Setting up Mono Info /Volumes/Macintosh HD/Users/Shared/UnrealEngine/4.7/Engine /Volumes/Macintosh HD/Users/Shared/UnrealEngine/4.7/Engine/Binaries/Mac Info Compiling with Mac SDK 10.10 Info Parsing headers for MyProject3Editor Info Reflection code generated for MyProject3Editor Info Performing 3 actions (8 in parallel) Info [1/3] Compile MyProject3.generated.cpp Info [2/3] Compile MyActor1.cpp Info [3/3] Link UE4Editor-MyProject3-4095.dylib Info Undefined symbols for architecture x86_64: Info "vtable for AMyActor1", referenced from: Info AMyActor1::AMyActor1() in MyActor1.cpp.o Info AMyActor1::AMyActor1() in MyActor1.cpp.o Info NOTE: a missing vtable usually means the first non-inline virtual member function has no definition. Info ld: symbol(s) not found for architecture x86_64 Info clang: error: linker command failed with exit code 1 (use -v to see invocation) Info -------- End Detailed Actions Stats ----------------------------------------------------------- Info ERROR: UBT ERROR: Failed to produce item: /Volumes/Macintosh HD/Users/kevin/Documents/Unreal Projects/UE4Sandbox/Binaries/Mac/UE4Editor-MyProject3-4095.dylib Info Cumulative action seconds (8 processors): 0.00 building projects, 8.88 compiling, 0.00 creating app bundles, 0.00 generating debug info, 0.13 linking, 0.00 other Info UBT execution time: 14.46 seconds
Header
class MYPROJECT3_API AMyActor1 : public AActor { GENERATED_BODY() public: AMyActor1(); virtual void BeginPlay() override; virtual void Tick( float DeltaSeconds ) override; UPROPERTY(Replicated) TArray IntegerArray; };
Implementation
AMyActor1::AMyActor1() { PrimaryActorTick.bCanEverTick = true; } void AMyActor1::BeginPlay() { Super::BeginPlay(); } void AMyActor1::Tick( float DeltaTime ) { Super::Tick( DeltaTime ); }