Undefined link to 'QNetworkAccessManager'

I am new to the QT API and QT IDE, I followed this guide: http://developer.nokia.com/community/wiki/Creating_an_HTTP_network_request_in_Qt , but when I try to compile I get these errors, usually the problem is: the compiler could not find the .cpp / .lib archive, where the code for the methods is located, but in this case the api is already configured, I can’t understand why I am getting this error, and also I could not find the property project, here is my test code:

#include <QMainWindow>
#include <QUrl>
#include <QtNetwork/QNetworkAccessManager>
#include <QtNetwork/QNetworkRequest>
#include <QtNetwork/QNetworkReply>

these are the headers included in the mainwindow.hpp file, now mainwindow.cpp:

MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
    ui->setupUi(this);

    QNetworkAccessManager* nam;

    nam = new QNetworkAccessManager(this);
    QObject::connect(nam, SIGNAL(finished(QNetworkReply*)),
         this, SLOT(finishedSlot(QNetworkReply*)));

    QUrl url("http://www.forum.nokia.wiki");
    QNetworkReply* reply = nam->get(QNetworkRequest(url));
}

ready method:

void MainWindow::finishedSlot(QNetworkReply* reply)
{
    //nothing
}

so this is code, if someone can help, I thank you :)

+4
source share
1 answer

QT += network .pro?

: , config QT

+13

Source: https://habr.com/ru/post/1535550/


All Articles