PDA

View Full Version : Help me with QNetworkAccessManager. Err: undefined reference.



g16bit
7th April 2011, 18:02
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:

QNetworkAccessManager *manager;
in MainWindow.cpp:

manager = new QNetworkAccessManager(this);
QNetworkReply *rep = manager->get(QNetworkRequest(QUrl("http://www.google.com")));

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.

stampede
7th April 2011, 18:20
You must have Qt+= network in .pro file

g16bit
7th April 2011, 18:24
thank you very much. Its allright now.

ChrisW67
10th April 2011, 23:09
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