Important: Please read the Qt Code of Conduct -

How to exclude generated moc_files from direct compilation?

  • I have one qtcreator project which use the private class XXXPrivate and the private class XXXPrivate have some slot functions, such as f1,f2, ....,etc.

    declare the private slot in XXX header file, such as,
    class XXXPrivate;
    Class XXX{

    Q_PRIVATE_SLOT(d_func(), void f1(void))

    but get Compiler Error C2027 from generated moc file.
    Is anyone help to solve the question that how to exclude the generated moc file from direct compilation.

  • Lifetime Qt Champion


    If you declare slots, you need to have them implemented even if the method is empty.

Log in to reply