**https://docs.unrealengine.com/latest…s/1/index.html
Engine version**: 4.18
Detailed description of the issue: Compiling the finished code throws an error: error C2653: ‘ConstructorHelpers’: is not a class or namespace name
Fix: An extra include statement is required in CollidingPawn.cpp
#include “Runtime/CoreUObject/Public/UObject/ConstructorHelpers.h”
Edit:
I also think it is worth mentioning to people how to declare other basic components in this doc. For example, if someone tries to make a UCameraComponent in their .h for the following reason (as per the example):
“We can create Components without making variables to track them, but if we want to use those Components in our code, we should store them in class member variables like this.”
I wanted to keep track of my camera. So I add to my .h:
UCameraComponent* CameraComp;
This doesn’t compile. We get a completely weird error:
"error C2143: syntax error: missing ‘;’ before ‘*’
This is confusing because no ‘;’ is missing. The file looks correct. Googling that error leads to this: Could I get some help resolving "syntax error : missing ';' before '*'"? - Programming & Scripting - Unreal Engine Forums
Okay, let’s try that!
class UCameraComponent* CameraComp;
Doesn’t compile. error C2027: use of undefined type ‘UCameraComponent’
Googling that error led me to the solution of importing it:
#include “Runtime/Engine/Classes/Camera/CameraComponent.h”
This is a caveat that should be explained in the docs. If you just want to add UStaticMeshComponent or UParticleSystemComponent (like in the example), then this step isn’t needed. Every component that needs an import step should be listed I think.