Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

UCLASS, UFUNCTION support inside macros request

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) \
    class MY_API U##cls_name : public UObject\

Thanks :)

Product Version: Not Selected
more ▼

asked Jul 13 '17 at 09:39 AM in C++ Programming

avatar image

579 45 65 93

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

This works for me:

 #define DECLARE_SUPERCLASS(api_name, cls_name) \
 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.

more ▼

answered Jul 14 '17 at 02:38 AM

avatar image

466 13 11 26

avatar image broly Jul 14 '17 at 09:33 AM

I've tested this and got error ../Classes/Utils.h(1): error : Missing 'class' in Class declaration Missing 'class' in Class declaration.

alt text

customclass.png (9.8 kB)
avatar image Vawx Jul 15 '17 at 03:50 AM

Yeah it doesn't like the GENERATED_BODY() or UPROPERTY( )

You'll probably need another way to generate this code.

avatar image Jackblue Jul 16 '17 at 09:12 PM

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 :)

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question