There are numerous [threads](https://www.google.co.in/search?q=a%20missing%20vtable%20usually%20means%20the%20first%20non-inline%20virtual%20member%20function%20has%20no%20definition&oq=a%20missing%20vtable%20usually%20means%20the%20first%20non-inline%20virtual%20member%20function%20has%20no%20definition) on this all over. None seems to fit my bill. I'm getting the following linker errors in my code:

```
Undefined symbols for architecture x86_64:
  "vtable for MSFSPlugin::MSFSPluginImpl", referenced from:
      MSFSPlugin::MSFSPluginImpl::MSFSPluginImpl(QObject*) in MSFSPlugin.o
      MSFSPlugin::MSFSPluginImpl::~MSFSPluginImpl() in MSFSPlugin.o
  NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

```

It should have been something obvious as - *a missing vtable usually means the first non-inline virtual member function has no definition*. However, I don't see what I'm missing:

I have this class declation in `MSFSPlugin.h`:

```
class MSFSPlugin
    :
    public QObject,
    public IMediaSource
{
    Q_OBJECT
    Q_INTERFACES(IMediaSource)
    ...
protected:
    class MSFSPluginImpl;
    MSFSPluginImpl* mImpl;

}

```

Then in `MSFSPlugin.cpp`, I have the following:

```
class MSFSPlugin::MSFSPluginImpl : public QThread
{
    Q_OBJECT
    public:
        MSFSPluginImpl(QObject *parent = 0);
        virtual ~MSFSPluginImpl();

        QString     getSourceDirectory() const;
        void        setSourceDirectory(QString sourceDirectory);

    signals:
        void        loadDirectoryFinished(bool success);

    protected:
        QString     mSourceDirectory;
};

```

Followed by definitions:

```
MSFSPlugin::MSFSPluginImpl::MSFSPluginImpl(QObject *parent) : QThread(parent)
{
}

MSFSPlugin::MSFSPluginImpl::~MSFSPluginImpl()
{
}

QString MSFSPlugin::MSFSPluginImpl::getSourceDirectory() const
{
    return mSourceDirectory;
}

void MSFSPlugin::MSFSPluginImpl::setSourceDirectory(QString sourceDirectory)
{
    mSourceDirectory = sourceDirectory;
}

...

```

In short, I don't think I'm missing any non-inline virtual member function definition. I'm using:

```
Apple LLVM version 5.1 (clang-503.0.40) (based on LLVM 3.4svn)
Target: x86_64-apple-darwin13.1.0
Thread model: posix

```

**Additional Info:**

In my `moc_MSFSPlugin.cpp` I don't see the autogenerated `Q_OBJECT` related code for class `MSFSPlugin::MSFSPluginImpl` which indirectly (via QThread) derives from `QObject`. Specifically, I don't see code generated for the signal, declared in that class (`loadDirectoryFinished`). Could this be the problem?

**EDIT 1:**
The error goes away if I comment out `Q_OBJECT` from the declation of `MSFSPlugin::MSFSPluginImpl`, but then I lose the signal functionality.

**EDIT 2:**
I see moc operates on header files only. Could this be related to the fact that my QObject derived class is declared & defined in a .cpp file?