broly
(broly)
July 13, 2017, 9:39am
1
It’s will be great if we will able to place UCLASS
, UFUNCTION
, etc inside macros and it will be work after substitution.
For example, higher level code generation.
#define DECLARE_SUPERCLASS(cls_name) \
UCLASS()
class MY_API U##cls_name : public UObject\
{\
...\
}
Thanks
Vawx
(Vawx)
July 15, 2017, 3:50am
2
Yeah it doesn’t like the GENERATED_BODY() or UPROPERTY( )
You’ll probably need another way to generate this code.
Vawx
(Vawx)
July 14, 2017, 2:38am
3
This works for me:
#define DECLARE_SUPERCLASS(api_name, cls_name) \
UCLASS()\
class api_name U##cls_name : public UObject\
{\
\
};\
I tested in a engine plugin, which is why I substituted the MY_API with the argument.
broly
(broly)
July 14, 2017, 9:33am
4
I’ve tested this and got error ../Classes/Utils.h(1): error : Missing 'class' in Class declaration Missing 'class' in Class declaration
.
Jackblue
(Jackblue)
July 16, 2017, 9:12pm
5
This is a normal behavior because UHT parse header before compiler replace macro.
The solution will be to replace some kind of macro with UHT, parse to scan UCLASS and UFUNCTION properties, and finally compiler replace last macros. Hope one day Epic improve this tool