+ Reply to Thread
Results 1 to 6 of 6

Thread: Unresolved external symbol "staticMetaObject"

  1. #1

    Default Unresolved external symbol "staticMetaObject"

    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
    Attached Files Attached Files

  2. #2
    Join Date
    Dec 2009
    Posts
    126
    Thanks
    7
    Thanked 14 Times in 14 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Unresolved external symbol "staticMetaObject"

    maybe the "-no-webkit" option is too much here ?

  3. #3

    Default Re: Unresolved external symbol "staticMetaObject"

    Totem, I just used -no-webkit to speed up the build -- do you mean webkit should be build for dependency? Thanks.

  4. #4
    Join Date
    Feb 2010
    Posts
    99
    Thanks
    31
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Unresolved external symbol "staticMetaObject"

    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???

  5. #5
    Join Date
    Sep 2009
    Location
    Surrey, BC, Canada
    Posts
    101
    Thanks
    1
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Unresolved external symbol "staticMetaObject"

    My post is here
    http://www.qtcentre.org/threads/3202...tPlot-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
    Welcome to Vision Open
    http://www.visionopen.com

  6. #6
    Join Date
    Sep 2009
    Location
    Surrey, BC, Canada
    Posts
    101
    Thanks
    1
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Unresolved external symbol "staticMetaObject"

    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-...ch/006230.html


    Well, may I ask:

    1)
    What is the purpose of
    Qt Code:
    1. Q_OBJECT
    To copy to clipboard, switch view to plain text mode 
    after my class definition? For example, my class looks like:
    Qt Code:
    1. class CDataPlot : public QwtPlot
    2. {
    3. Q_OBJECT
    4. private:
    5. ....
    6. };
    To copy to clipboard, switch view to plain text mode 
    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
    Welcome to Vision Open
    http://www.visionopen.com

+ Reply to Thread

Similar Threads

  1. unresolved external symbol with qwt3d
    By pospiech in forum Qt Programming
    Replies: 5
    Last Post: 20th April 2010, 00:03
  2. unresolved external symbol
    By gridolfi in forum Qt Programming
    Replies: 1
    Last Post: 8th September 2009, 17:58
  3. Replies: 1
    Last Post: 10th April 2009, 18:07
  4. unresolved external symbol
    By tgreaves in forum Qt Programming
    Replies: 2
    Last Post: 16th January 2009, 19:49
  5. Unresolved External Symbol
    By munna in forum General Discussion
    Replies: 1
    Last Post: 10th May 2006, 19:25

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts