Getting lots of undefined references when using QtNetwork components
#include "QtGui"
#include "QtNetwork/QtNetwork"
#include "QtNetwork/qnetworkaccessmanager.h"
#include "QtNetwork/qnetworkrequest.h"
#include "QtNetwork/QNetworkAccessManager"
#include "QtNetwork/QNetworkRequest"
......
bool NewAccountDialog::verifyAccount()
{
QString loginURL = "https://accounts.craigslist.org/";
QByteArray USERAGENT = "Mozilla/Firefox 3.6.12";
QNetworkAccessManager * manager = new QNetworkAccessManager(this);
QNetworkRequest request;
request.setUrl(QUrl("http://qt.nokia.com"));
request.setRawHeader("User-Agent", "MyOwnBrowser 1.0");
// QNetworkRequest * request = new QNetworkRequest();
.........
}
I eventually just changed it to the example qt uses for testing and I still get the problem, every method of the network classes I call I get undefined reference errors. So far this has only happened with the network components, the gui's fine so I'm wonder开发者_StackOverflow中文版ing if it's my fault somehow.
You need to link against module network
. To do that add to .pro
file
QT += network
Check http://doc.qt.io/qt-4.8/qtnetwork-module.html#details for reference.
精彩评论