Best practice for workaround moc's inability to handle ifdef?
-
I have the following code:
public slots: #if !defined(Q_OS_MACOS) void installOrRestartClicked(QAbstractButton* button, QString filePath); #endif #if !defined(Q_OS_MACOS) void Updater::installOrRestartClicked(QAbstractButton* button, QString filePath) { ...moc on macOS still finds this code and fails the compilation for me:
/Users/travis/build/Mudlet/Mudlet/build/src/moc_updater.cpp:84:21: error: no member named 'installOrRestartClicked' in 'Updater' case 1: _t->installOrRestartClicked((*reinterpret_cast< QAbstractButton*(*)>(_a[1])),(*reinterpret_cast< QString(*)>(_a[2]))); break; ~~ ^ 1 error generated.very annoying. One way to deal with this is to leave the declaration intact and just do:
void Updater::installOrRestartClicked(QAbstractButton* button, QString filePath) { #if !defined(Q_OS_MACOS) ...How do other people workaround this moc bug?
-
Hi,
What version of Qt are you using ?
-
Can you try with ifndef ?