Results 1 to 4 of 4

Thread: Help me with QNetworkAccessManager. Err: undefined reference.

  1. #1
    Join Date
    Mar 2011
    Posts
    8
    Thanks
    4
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Post Help me with QNetworkAccessManager. Err: undefined reference.

    Im going to write a small program to download a link (QUrl) using QNetworkAccessManager. I found in QT help things are explain very simple. I do the same:
    in Header file MainWindow.h:
    Qt Code:
    1. QNetworkAccessManager *manager;
    To copy to clipboard, switch view to plain text mode 
    in MainWindow.cpp:
    Qt Code:
    1. manager = new QNetworkAccessManager(this);
    2. QNetworkReply *rep = manager->get(QNetworkRequest(QUrl("http://www.google.com")));
    To copy to clipboard, switch view to plain text mode 

    But when I compile this prog, there are error messages: undefined reference to QNetworkAccessManager::QNetworkAccessManager(QObje ct*)

    I cant understand why even though I read help file for ten times. Please help me. Thank you very mcuh.

  2. #2
    Join Date
    Sep 2009
    Location
    Wroclaw, Poland
    Posts
    1,394
    Thanked 342 Times in 324 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: Help me with QNetworkAccessManager. Err: undefined reference.

    You must have Qt+= network in .pro file

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

    g16bit (7th April 2011)

  4. #3
    Join Date
    Mar 2011
    Posts
    8
    Thanks
    4
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Help me with QNetworkAccessManager. Err: undefined reference.

    thank you very much. Its allright now.

  5. #4
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Help me with QNetworkAccessManager. Err: undefined reference.

    For future reference, the necessary additions to the project file for any class are found on the page describing the module containing the class:
    http://doc.qt.nokia.com/latest/qtnetwork.html

Similar Threads

  1. Undefined reference
    By eekhoorn12 in forum Qt Programming
    Replies: 2
    Last Post: 6th January 2011, 15:45
  2. undefined reference
    By digidas in forum Newbie
    Replies: 9
    Last Post: 19th May 2010, 13:04
  3. undefined reference
    By jayreddy in forum Qt Programming
    Replies: 1
    Last Post: 20th November 2009, 13:45
  4. Undefined reference to crt
    By derektaprell in forum Installation and Deployment
    Replies: 0
    Last Post: 20th October 2009, 08:34
  5. Undefined reference
    By Salazaar in forum Newbie
    Replies: 12
    Last Post: 23rd May 2007, 10:21

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.