#The bug
-
Create a blank file (I used /Game/Public/Structs/MyStruct.h)
-
Add the following code
#pragma once
include “Object.h”
USTRUCT()
struct FMyStruct
{
GENERATED_USTRUCT_BODY()
}; -
Compile
You will get the following error: error C2143: syntax error: missing ';' before '}'
#Solution
After much debugging, I have finally found the issue using the Struct reference, in the line that states
Structs are declared prior to the class declaration.
Moving the same empty struct in front of a UCLASS declaration (empty or not) then allows the project to compile.
#Conclusion
This is (arguably) a bug. At the very least, the error message should be more sensible/informative.