No problems with compiling this code here.
Added this to header:
#include <QDebug>
#include <QNetworkAccessManager>
#include <QUrl>
#include <QNetworkRequest>
#include <QObject>
class ClientHandler
: public QObject{ // << on this line
Q_OBJECT
QNetworkAccessManager *manager;
private slots:
void replyFinished(QNetworkReply *);
public:
void CheckSite(void);
~ClientHandler();
};
#include <QDebug>
#include <QNetworkAccessManager>
#include <QUrl>
#include <QNetworkRequest>
#include <QObject>
class ClientHandler : public QObject
{ // << on this line
Q_OBJECT
QNetworkAccessManager *manager;
private slots:
void replyFinished(QNetworkReply *);
public:
void CheckSite(void);
~ClientHandler();
};
To copy to clipboard, switch view to plain text mode
This to .cpp:
void ClientHandler::replyFinished(QNetworkReply *reply) { qDebug() << "DONE"; }
ClientHandler::~ClientHandler() {} // <<-- on this line
void ClientHandler::CheckSite(void)
{
QUrl qrl
("http://checkip.dyndns.org");
manager = new QNetworkAccessManager(this);
connect(manager, SIGNAL(finished(QNetworkReply*)), this, SLOT(replyFinished(QNetworkReply*)));
manager->get(QNetworkRequest(qrl));
}
void ClientHandler::replyFinished(QNetworkReply *reply) { qDebug() << "DONE"; }
ClientHandler::~ClientHandler() {} // <<-- on this line
void ClientHandler::CheckSite(void)
{
QUrl qrl("http://checkip.dyndns.org");
manager = new QNetworkAccessManager(this);
connect(manager, SIGNAL(finished(QNetworkReply*)), this, SLOT(replyFinished(QNetworkReply*)));
manager->get(QNetworkRequest(qrl));
}
To copy to clipboard, switch view to plain text mode
Included header in main.cpp and I can use ClientHandler objects:
#include <QApplication>
#include "ClientHandler.h"
int main( int argc, char ** argv ){
ClientHandler h;
return 0;
}
#include <QApplication>
#include "ClientHandler.h"
int main( int argc, char ** argv ){
QApplication app(argc,argv);
ClientHandler h;
return 0;
}
To copy to clipboard, switch view to plain text mode
Then simply: qmake, make - compiled without errors.
Maybe try to do clean rebuild ( make clean, qmake, make ).
Bookmarks