Linker error LNK2019 with two actor classes that call stuff from each other

I’m getting a linker error.

I have two classes that extends the AActor class: APool and APoolActor.

APoolActor has a class member which is a pointer to a APool object, APool has two pointers to APoolActor objects.
I forward declare the APoolActor class in the Pool.h file, and forward declare the APool class in the PoolActor.h file. I then do #include “PoolActor.h” in the Pool.cpp file, and #include “Pool.h” in the PoolActor.cpp file.

In the PoolActor.cpp i do this:

(‘MyPool’ being APoolActor’s pointer to a APool object, and ‘DeactivateThing(APoolActor thing)’ being a method in the APool class that takes in a APoolActor)

And this seems to cause the linker error. However if I changed the DeactivateThing method so that it takes no argumnets then there is no error. So I assume i’ve done something stupid here that im not aware of.

Here is the linker error:

That’s trying to call a copy-constructor due to the pass-by-value in the function signature: DeactivateThing(APoolActor thing)

UObject-based types don’t have copy-constructors, as this is likely isn’t what you want to be doing. You should probably be passing APoolActor*.

yup that works it seems.

I changed DeactivateThing to DeactivateThing(APoolActor &thing), which I assume will not copy the thing but pass by referance.

Thank you :slight_smile: