PDA

View Full Version : Unresolved external symbol "staticMetaObject"



sr71
10th May 2010, 10:49
Hi Guys,

I'm build an application with VS2008+QT4.6.2 (configure it as static)
Steps:
configure -release -static -fast -qt-gif -qt-libjpeg -qt-sql-odbc -openssl-linked -qt-sql-sqlite -no-webkit -qt-zlib -no-dbus -no-phonon -nomake examples -nomake docs -nomake demos -nomake translations -platform win32-msvc2008
qmake -config release
nmake

However some linking errors are reported as below:
link /LIBPATH:"c:\Qt\lib" /NOLOGO /INCREMENTAL:NO /MANIFEST /MANIFESTFIL
E:"release\QtWeb.intermediate.manifest" /SUBSYSTEM:WINDOWS "/MANIFESTDEPENDENCY:
type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' publicKe
yToken='6595b64144ccf1df' language='*' processorArchitecture='*'" /OUT:release\Q
tWeb.exe @C:\DOCUME~1\sr71\LOCALS~1\Temp\nm6B5.tmp
moc_history.obj : error LNK2001: unresolved external symbol "public: static stru
ct QMetaObject const QWebHistoryInterface::staticMetaObject" (?staticMetaObject@
QWebHistoryInterface@@2UQMetaObject@@B)
moc_webpage.obj : error LNK2001: unresolved external symbol "public: static stru
ct QMetaObject const QWebPage::staticMetaObject" (?staticMetaObject@QWebPage@@2U
QMetaObject@@B)
moc_webview.obj : error LNK2001: unresolved external symbol "public: static stru
ct QMetaObject const QWebView::staticMetaObject" (?staticMetaObject@QWebView@@2U
QMetaObject@@B)

The generated moc_history.cpp is attached.

Could someone give me a hand on this? Thanks a lot.

Cheers
Rick

totem
10th May 2010, 14:43
maybe the "-no-webkit" option is too much here ?

sr71
10th May 2010, 15:19
Totem, I just used -no-webkit to speed up the build -- do you mean webkit should be build for dependency? Thanks.

dpatel
25th May 2010, 08:04
sr71, I am also getting same linker error. My setup is VS2005 + Qt 4.6.2 (precompiled libs that Qt provides)

I don't think -no-webkit is an issue.

I found that if I remove Q_OBJECT from .h file the application compiles ok. Also I exported the project to .pro and compiling it in Qt Creator also works fine (this is with Q_OBJECT) in .h file. I don't think that removing Q_OBJECT is a solution to this issue. Anybody???

jiapei100
29th June 2010, 22:52
My post is here
http://www.qtcentre.org/threads/32028-unresolved-external-symbol-quot-public-static-struct-QMetaObject-const-QwtPlot-staticMe

Probably, I've got exactly the same problem as yours.
Did you solve this problem already? If so, please do give me a hand.

Thank you very much in advance.

Best Regards
JIA

jiapei100
29th June 2010, 23:26
Yes, after removing
Q_OBJECT from my .h file, I can get my application compiled and built.
However, when I ran it, I confronted another issue "Seg fault on program start", as posted here:
http://www.osgeo.org/pipermail/qgis-developer/2009-March/006230.html


Well, may I ask:

1)
What is the purpose of
Q_OBJECT after my class definition? For example, my class looks like:

class CDataPlot : public QwtPlot
{
Q_OBJECT
private:
....
};

What is
Q_OBJECT used for?


2)
Without Q_OBJECT, I obtained this warning and the program won't start.

Warning: QObject::connect: Connecting from COMPAT signal (QAction::activated())

With Q_OBJECT, I obtained the following error compilation message:

error LNK2001: unresolved external symbol "public: static struct QMetaObject const QwtPlot::staticMetaObject" (?staticMetaObject@QwtPlot@@2UQMetaObject@@B)

3) My Environments:
WindowsXP+Visual Studio 2008+qt-vs-addin-1.1.5.exe+qwt-5.2.1

4)
In addition, under Ubuntu 10.04, the same program runs perfectly.

So, can anybody help please?

Best Regards
JIA