#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();
.........
}
我最终只是将它更改为qt用于测试的示例,我仍然遇到问题,我调用的网络类的每个方法都得到未定义的引用错误。到目前为止这只发生在网络组件上,gui很好,所以我想知道这是不是我的错。
答案 0 :(得分:7)
您需要链接到模块network
。为此,请添加到.pro
文件
QT += network
检查http://doc.qt.io/qt-4.8/qtnetwork-module.html#details以供参考。