C2144: Syntax Error Missing ‘;’ Before ‘Type’ in Unreal Engine 5 (UE5 C++) – What It Means & How to Fix It
🧠 Why You’re Seeing This Error
The C2144
error happens when the compiler was expecting a semicolon, but instead found a type declaration (like int32
, float
, or FVector
). This usually means:
- You forgot a
;
after a class or struct - You’re declaring a variable after an invalid or incomplete statement
- There’s a macro like
GENERATED_BODY()
orUPROPERTY()
that’s broken or missing - A previous line is corrupting the syntax of the next one
In UE5, this error is often tied to macro-heavy class definitions where one small syntax issue cascades into errors down the line.
💥 Example Error Message
error C2144: syntax error: 'int' should be preceded by ';'
🛠️ Example Code
UCLASS()
class AMyActor : public AActor
{
GENERATED_BODY()
UPROPERTY()
int32 Health
int32 Score; // ❌ C2144: syntax error: missing ';' before 'int'
};
✅ How to Fix C2144 UE5 – Step-by-Step
✔️ 1. Make Sure Each Statement Ends with a Semicolon
The line before the one causing the error is often the true culprit.
Fix:
UPROPERTY()
int32 Health; // ✅ Add semicolon here
✔️ 2. Check for Broken Macros Like GENERATED_BODY()
If you accidentally delete or misplace GENERATED_BODY()
, Unreal’s code generation system breaks, and everything that follows becomes a mess of syntax errors.
Wrong:
UCLASS()
class AMyActor : public AActor
{
// GENERATED_BODY() is missing
int32 Health;
};
Fix:
UCLASS()
class AMyActor : public AActor
{
GENERATED_BODY()
int32 Health;
};
✔️ 3. Look Above the Line With the Error
C2144 is often a domino effect from a mistake above. Check for:
- A missing closing brace
}
- A missing
;
- A mistyped macro
✔️ 4. Fix Function or Enum Declarations
You might have a function declared without a return type or a custom enum with incorrect formatting.
Wrong:
MyFunction()
{
// ...
}
int32 Health; // ❌ C2144 here
Fix:
void MyFunction()
{
// ...
}
int32 Health;
✅ Summary: How to Fix C2144 in UE5
Cause | Fix |
---|---|
Missing ; after a statement | Add semicolon after the previous line |
Broken macro | Ensure GENERATED_BODY() , UPROPERTY() , etc. are correct |
Bad function or enum syntax | Add return type or formatting |
Missing class/struct semicolon | Add ; after class or struct definition |