#include class LocalObject : public QObject { Q_OBJECT public: LocalObject(){}; }; void mocOnly() { LocalObject obj; } #include "main.moc"