UBT: Missing ';' in 'variable declaration'

#define PLACE(x) x

USTRUCT()
struct FTest
{
	GENERATED_BODY()

	UPROPERTY(EditAnywhere)
	int32 PLACE(a);
};

Error: Missing ‘;’ in ‘variable declaration’

How to avoid that error?

Hey ShiftZ-

Can you explain what your define is attempting to do? Defines are usually used to substitute a section of code for something else. For example #define print(text) {if (GEngine) { GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Yellow, text); }} would allow you to use print(“Hello World”); in place of the GEngine line. In the case of your define, it seems to be saying “use PLACE(input) instead of input alone”. The best way to avoid the error would be to simply use int32 a; without using the PLACE define.

Can you explain what your define is attempting to do?

If that matters, i’m trying to use another reflection system (the header is shared with noneUE project).
But it actually does not matter, because the code above is a valid c++ code, it does not violate any declared coding conventions and UBT does not accept it.
This should be considered as a bug.

Hey ShiftZ-

Though it is valid C++, it is not valid for UBT parsing. I was able to remove the UPROPERTY macro and compile successfully, so you should be able to use the following to use both PLACE() as well as have the variable available in the editor.

 int32 PLACE(a);

 UPROPERTY(EditAnywhere)
 int32 NewVar = a;

Cheers