Important: Please read the Qt Code of Conduct -

Qt 5.5.0 moc: explicitly need to define QT_VERSION

  • Hi,

    I am creating a Qt plugin on Mac and using Qt 5.5.0.
    This conforms to the standard way(s) of creating a Qt plugin.
    When running moc on the plugin source, I do not get the expected
    QT_MOC_EXPORT_PLUGIN(..., ...) /* name omitted */
    line that should be generated by moc to create a plugin.
    However if on the moc command I pass, -DQT_VERSION=0x050000, this line does get generated.

    However on Windows it works as expected, and -DQT_VERSION=0x050000 is not needed.

    Why is this difference in moc behaviour between Windows and Mac?
    Shouldn't moc 'know' the Qt Version without being explicitly told?

  • Lifetime Qt Champion

    Hi and welcome to devnet,

    Are you running moc by hand ?

  • @SGaist Hi,
    Its a Xcode project and moc (the version that is part of Qt 5.5.0) is called as part of the build phases.
    The header comment on top of the generated moc file confirms that the Qt version is 5.5.0

  • Lifetime Qt Champion

    Using the macx-xcode mkspec ?

Log in to reply