[SOLVED] Get remote web code
hello everyone ..
I would pick up the HTML code for a page remotely. this is my code and related errors.
MainWindow::MainWindow(QWidget *parent) :
QNetworkAccessManager *manager = new QNetworkAccessManager(this); connect(manager, SIGNAL(finished(QNetworkReply*)), this, SLOT(replyFinished(QNetworkReply*))); manager->get(QNetworkRequest(QUrl("http://qtsoftware.com")));
mainwindow.cpp:11: error: undefined reference to
QNetworkAccessManager::QNetworkAccessManager(QObject*)' mainwindow.cpp:15: error: undefined reference toQNetworkRequest::QNetworkRequest(QUrl const&)'
mainwindow.cpp:15: error: undefined reference to
QNetworkAccessManager::get(QNetworkRequest const&)' mainwindow.cpp:15: error: undefined reference toQNetworkRequest::~QNetworkRequest()'
Did you added
@QT += network@
To your pro file ?
Though it should be in by default IIRC
no, I have not added. in which files should be placed? and in what position? thank you.
A Former User last edited by
It needs to be added to your project file which is named after your project and has .pro as filename extension.
thanks a lot, now runs without errors.
in the bottom of the document I added this slot:
void MainWindow::replyFinished(QNetworkReply *pReply)
qWarning() << str;
but in the application otput not see anything, only ""
then enters into the slot but does not read anything.
I tried it on another pc and it works , thanks a lot to everyone.