Getting a error but will still compile/build how do I take care of it?

So I’m getting this error:

and this is the code:

It all works fine and compiles and even builds but how do I get rid of this error?

Unreal recently changed their include structure. This error ‘pointer to incomplete class type’ is the error message telling you that you are missing an include file.

Here is how you can track any of these issues down. First you need to figure out where this variable is defined in order to determine the type. In your case it’s line 70 when you call ‘GetComponent’ on the ‘HitResult’ variable. IIRC HitResult is an FHitResult so we can browse to the unreal api documentation (just google FHitResult and it’s the top result). Next search the page for the method being called ‘GetComponent’ and we can see that it returns a ‘UPrimitiveComponent’. That is the type the compiler does not know about. You can follow the link from FHitResult page to the UPrimitiveComponent page, then navigate to the VERY bottom of the page and there is a line there specifying which header the component is defined in, in this case it’s “Runtime/Engine/Classes/Components/PrimitiveComponent.h”. You are going to want to include this in your CPP file, not the H.

You can follow this pattern to fix any of these errors.

Video 64 “Include what you use for 4.17+” in the course covers this issue in video form if you would prefer.

1 Like

Thanks I had no idea it was a include causing the problem!

Privacy & Terms