Results 1 to 9 of 9

Thread: undefined reference to `QWebView::QWebView(QWidget*)'

  1. #1
    Join Date
    Jul 2010
    Posts
    2
    Qt products
    Qt4
    Platforms
    Unix/X11

    Question undefined reference to `QWebView::QWebView(QWidget*)'

    Hi,

    I'm trying to build a browser app, just to test Qt. this is my program so far:

    Qt Code:
    1. #include <QApplication>
    2. #include <QtWebKit/QWebView>
    3.  
    4. int main(int argc, char **argv)
    5. {
    6. QApplication app(argc, argv);
    7. QWebView *view = new QWebView();
    8.  
    9. view->load(QUrl("http://www.yahoo.com"));
    10. view->show();
    11.  
    12. return app.exec();
    13. }
    To copy to clipboard, switch view to plain text mode 

    all I get is a undefined reference to `QWebView::QWebView(QWidget*)'

    what am I doing wrong?

    thanks

  2. #2
    Join Date
    Jan 2006
    Location
    Belgium
    Posts
    1,938
    Thanked 268 Times in 268 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    20

    Default Re: undefined reference to `QWebView::QWebView(QWidget*)'

    Did you add the following line to your .pro file?

    Qt Code:
    1. QT += webkit
    To copy to clipboard, switch view to plain text mode 

  3. The following user says thank you to tbscope for this useful post:

    TheIndependentAquarius (25th May 2011)

  4. #3
    Join Date
    May 2010
    Location
    Romania
    Posts
    1,021
    Thanks
    62
    Thanked 260 Times in 246 Posts
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: undefined reference to `QWebView::QWebView(QWidget*)'

    Add the following line to the project file (.pro file)
    Qt Code:
    1. QT += webkit
    To copy to clipboard, switch view to plain text mode 
    And then Rebuild (or Clean All and then Rebuild)

  5. #4
    Join Date
    Jul 2010
    Posts
    2
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: undefined reference to `QWebView::QWebView(QWidget*)'

    working! thanks both!

  6. #5
    Join Date
    Mar 2011
    Posts
    1
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60

    Unhappy Re: undefined reference to `QWebView::QWebView(QWidget*)'

    i have already added that in project file but in vain.
    not able to get rid of that error:

  7. #6
    Join Date
    May 2010
    Location
    Romania
    Posts
    1,021
    Thanks
    62
    Thanked 260 Times in 246 Posts
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: undefined reference to `QWebView::QWebView(QWidget*)'

    @raevilman: Post the code which uses QWebView.
    And have you tried Rebuild or Clean All then Rebuild?

  8. #7
    Join Date
    Nov 2011
    Posts
    1
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: undefined reference to `QWebView::QWebView(QWidget*)'

    Quote Originally Posted by Zlatomir View Post
    Add the following line to the project file (.pro file)
    Qt Code:
    1. QT += webkit
    To copy to clipboard, switch view to plain text mode 
    And then Rebuild (or Clean All and then Rebuild)
    Thanks! I was just about to try this and now I'm confident that it will work.

  9. #8
    Join Date
    Aug 2013
    Posts
    1
    Qt products
    Qt3 Qt Jambi
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Android Maemo/MeeGo

    Default Re: undefined reference to `QWebView::QWebView(QWidget*)'

    New QT 5.0 need to use <QtWebKitWidget/QWebView>

    and need add

    QT +=webkitwidget

  10. #9
    Join Date
    Jul 2012
    Posts
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: undefined reference to `QWebView::QWebView(QWidget*)'

    1) download last version Qt >= 5.1
    2) #include <QtWebKitWidgets/QWebView>
    3) in *.pro add webkitwidgets :
    QT += core gui webkitwidgets
    4) to use:
    webView->load(QUrl(lineEdit->text()));
    Last edited by marksh; 3rd September 2013 at 10:57.

Similar Threads

  1. undefined reference
    By digidas in forum Newbie
    Replies: 9
    Last Post: 19th May 2010, 14:04
  2. undefined reference
    By jayreddy in forum Qt Programming
    Replies: 1
    Last Post: 20th November 2009, 14:45
  3. Undefined reference to crt
    By derektaprell in forum Installation and Deployment
    Replies: 0
    Last Post: 20th October 2009, 09:34
  4. Replies: 6
    Last Post: 14th May 2009, 13:02
  5. QWebView undefined references
    By xtreme in forum Qt Programming
    Replies: 2
    Last Post: 28th July 2008, 09:08

Tags for this Thread

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.