I know that Qt4 moc was not able to do macro expanding, and now Qt5 moc can do it, at least partly.
I have macro for simple signals adding to multiple classes, lets say, for errors and warnings reports.

Qt Code:
  1. #define ERROR_SENDER \
  2. signals: \
  3. void error(Errors::ErrorCodes errorCode);
  4.  
  5. #define WARNING_SENDER \
  6. signals: \
  7. void warning(Warnings::WarningCodes warningCode);
  8.  
  9. #define ERROR_AND_WARNING_SENDER \
  10. ERROR_SENDER \
  11. WARNING_SENDER
To copy to clipboard, switch view to plain text mode 

And, in another header:

Qt Code:
  1. class Compressor : public QObject
  2. {
  3. Q_OBJECT
  4.  
  5. ERROR_AND_WARNING_SENDER
  6.  
  7. ...
  8. }
To copy to clipboard, switch view to plain text mode 

But it doesn't work. If I expand macro myself with simple copy-paste, it works, and signals are added in moc-generated file. But if I use macro, signals are not added in moc-generated file and it results in
./debug/compressor.o: In function `ZN10Compressor8openFileERK7QString6QFlagsIN9QIODe vice12OpenModeFlagEE':
compressor.cpp:40: undefined reference to `Compressor::error(Errors::ErrorCodes)'


How to fix it?