BlueprintNativeEvent function implement errors, can't open project

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.
ft1
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.

It could be because you are interacting with a static variable from within a blueprint exposed function. Unreal doesn’t play well with that mix.

Ignore the green underline warning. It should compile fine.

I fail everything. Compiles, rebuilds or builds just ends up failing. There’s no such red underline. Just a single green underline on that FindTarget. Green underlines aren’t supposed to be errors but why is this happening?

Now I can’t open the project. It says The following modules are missing or built with a different engine version. I saw this a few times before but this time it doesn’t allow me anything to do. I need to compile and rebuild the project to open but it fails. I installed dotNet Core, I tried Generate Visual Studio project files, maybe the last thing to do is to make the Visual Studio project compile successfully but the green line doesn’t allow to do so.

It’s not a matter of the green line.
You can add in the missing function in the cpp but it’s not going to be called anyway (only the implementation variant will be called by the engine)

My own projects are running fine without the cpp implementation of the base function.

You need to run the project from your IDE not from the project icon once you go c++.

The .gen file is the file generated for unreal. Do your modifications in the header file .h or c++ file .cpp


Sorry, It’s too hard for me to make no errors with a green underline.
My project just quits to compile/build if it can’t find the FindTarget.
But something strange is even I add an empty FindTarget function on cpp, it still makes an error and quit compiling.

Try it with a const and reference for the TArray (it should be immutable)

.h

virtual void FindTarget_Implementation(const TArray<AActor*>& ActorsInRange);

.cpp
void APlayerC::FindTarget_Implementation(const TArray<AActor*>& ActorsInRange){
}

and delete the non _Implementation version (the base) from the cpp or it will throw an error on compile.

to clarify get rid of

void APlayerC::FindTarget(TArray<AActor*> ActorsInRange){
// your code here
}

from your cpp if it’s there.

The green underline is gone now, but it says BlueprintNativeEvents aren’t supposed to be virtual. I can’t remove BlueprintNativeEvents from UPROPERTY because FindTarget must be implemented by blueprints and must be used in c++ files too.

And I got this error again.

C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.MakeFile.Targets(44,5): error MSB3073: The command ““C:\Program Files\Epic Games\UE_5.1\Engine\Build\BatchFiles\Build.bat” F15TestEditor Win64 Development -Project=“C:\Users\Park\Documents\Unreal Projects\F15Test 5.1\F15Test.uproject” -WaitMutex -FromMsBuild” exited with code 6.

I searched the error code MSB3073 on the internet. It seems to be related to file names containing spaces. Maybe I need to change the project settings to enable using spaces in files’ names.

Well with const and the reference & in the combination that I passed you compiles and runs with zero errors.

earlier you were asking for BlueprintImplementableEvent. With BlueprintNativeEvent there is no implementation just an empty ufunction definition in the header with it’s return and parameters & no presence in the cpp.

1 Like