The first time I made my c++ project and compiled it, I had a bunch of errors. After several changes on my code, I ended up 2 errors remaining. However these 2 errors took more time than the other errors did. These might be simple problems I guess, but I’m still finding for other threads or googling some similar cases, and eventually came here again asking questions hoping for some help.
C:\Users\Park\Documents\Unreal Projects\F15Test 5.1\Intermediate\Build\Win64\UnrealEditor\Inc\F15Test\UHT\PlayerC.gen.cpp(73): error C2511: ‘void APlayerC::FindTarget(const TArray<AActor *,FDefaultAllocator> &)’: overloaded member function not found in ‘APlayerC’
C:\Users\Park\Documents\Unreal Projects\F15Test 5.1\Source\F15Test\Public\PlayerC.h(15): note: see declaration of ‘APlayerC’
This is the first error out of 2. I assume that this is saying my FindTarget function isn’t found in my cpp file.
if (CurrentLoop == CurrentTarget)
FindTarget_Implementation(AirActorInRange);
Here is how I use my FindTarget function in cpp.
CurrentLoop and CurrentTarget are both AActor*.
Below is the FindTarget function in header file.
UFUNCTION(BlueprintNativeEvent)
void FindTarget(TArray<AActor*> ActorsInRange);
virtual void FindTarget_Implementation(TArray<AActor*> ActorsInRange);
I set the UPROPERTY specifier as BlueprintNativeEvent because I wanted this function to be implemented using only blueprints.
I was told whenever I want a blueprint-implemented function in c++, put the UFUNCTION macro on top, and put the base function I want, and finally the virtual+Implementation version of it. Maybe I got that right but Visual Studio shows a green underline on the FindTarget base function.
Did I get something wrong about this?
I once added an empty implementation of FindTarget as I did for FindTarget_Implementation, but I got same errors.
C:\Users\Park\Documents\Unreal Projects\F15Test 5.1\Intermediate\Build\Win64\UnrealEditor\Inc\F15Test\UHT\PlayerC.gen.cpp(77): error C2352: ‘UObject::FindFunctionChecked’: a call of a non-static member function requires an object
C:\Program Files\Epic Games\UE_5.1\Engine\Source\Runtime\CoreUObject\Public\UObject\Object.h(1198): note: see declaration of ‘UObject::FindFunctionChecked’
This is another error I encountered.
I tried to go see what the 77th line of Player.C.gen.cpp shows me and get some hints.
I found that this error was occurring from FindTarget again, but no luck.
If any other codes are needed, tell me and I’ll upload it as soon as possible.