We've compiled QT 4.6 and QWT 5.2.0 for VS2005.
We're trying to derive a class from QwtDial, and the derived class has slots. So, we need to add the Q_OBJECT macro. However, when we do that, the linker chokes out this error:
error LNK2001: unresolved external symbol "public: static struct QMetaObject const QwtDial::staticMetaObject" (?staticMetaObject@QwtDial@@2UQMetaObject@@B)
I've looked at the Qwt.dll with depends, and it has that function. Looking at the .lib file with a hex editor shows it has an exact match for that name-mangled string.
We have the Qwt lib in the path. Actually, if I rename the lib, then it gives an error that it can't find the lib file. So, we know it's looking at the right lib.
If we skip the Q_OBJECT, then everything links and draws correctly using several QWT widgets, including our non-Q_OBJECT Qwt derived classes.
Does anyone know what can cause this really annoying linker issue?
UPDATE:
I've verified that the class I add the Q_OBJECT to definitely is getting a MOC file generated for it. The linker error is actually coming from this generated MOC file:
moc_GaugeWidget1.obj : error LNK2001: unresolved external symbol "public: static
struct QMetaObject const QwtDial::staticMetaObject"
(?staticMetaObject@QwtDial@@2UQMetaObject@@B)
So, it's looking like something quite stange and atypical. The symbol is definitely in the lib.