Здравствуйте, есть такой класс:
#ifndef RFILEDOWNLOADER_H
#define RFILEDOWNLOADER_H
//--------Qt Headers
#include <QObject>
class QString;
class QNetworkAccessManager;
class QNetworkReply;
class QUrl;
class QNetworkRequest;
//-------My and other headers
//-------
class RFileDownloader: public QObject
{
Q_OBJECT
public:
explicit RFileDownloader(QObject *parent);
explicit RFileDownloader(const QUrl &url = QUrl(), QObject *parent = 0);
~RFileDownloader();
//Url
void setUrl(const QUrl &url) {_url = url;}
QUrl url() const {return _url;}
private:
QNetworkAccessManager _manager;
QUrl _url;
public slots:
void startDownloading(QUrl url = QUrl());
signals:
void finished(QNetworkReply *reply);
};
#endif // RFILEDOWNLOADER_H
Как вы видите, вместо включения файлов имеем одни лишь объявления.
Файл RFileDownloader.h включается в rizekFaster.h и RIconManager.h, оба этих файла имеют такие строки:
#include <QString>
#include <QNetworkAccessManager>
#include <QNetworkReply>
#include <QUrl>
#include <QNetworkRequest>
То есть содержать включения, но тем не менее я получаю такие ошибки:
In file included from Classes\RFileDownloader\RFileDownloader.cpp:3:
./Classes/RFileDownloader/RFileDownloader.h:24: error: field '_manager' has incomplete type
./Classes/RFileDownloader/RFileDownloader.h:25: error: field '_url' has incomplete type
./Classes/RFileDownloader/RFileDownloader.h:18: error: invalid use of incomplete type 'struct QUrl'
./Classes/RFileDownloader/RFileDownloader.h:9: error: forward declaration of 'struct QUrl'
./Classes/RFileDownloader/RFileDownloader.h:27: error: invalid use of incomplete type 'struct QUrl'
./Classes/RFileDownloader/RFileDownloader.h:9: error: forward declaration of 'struct QUrl'
./Classes/RFileDownloader/RFileDownloader.h: In member function 'void RFileDownloader::setUrl(const QUrl&)':
./Classes/RFileDownloader/RFileDownloader.h:21: error: '_url' was not declared in this scope
./Classes/RFileDownloader/RFileDownloader.h: In member function 'QUrl RFileDownloader::url() const':
./Classes/RFileDownloader/RFileDownloader.h:22: error: return type 'struct QUrl' is incomplete
./Classes/RFileDownloader/RFileDownloader.h:22: error: '_url' was not declared in this scope
Classes\RFileDownloader\RFileDownloader.cpp: In constructor 'RFileDownloader::RFileDownloader(const QUrl&, QObject*)':
Classes\RFileDownloader\RFileDownloader.cpp:13: error: '_url' was not declared in this scope
Classes\RFileDownloader\RFileDownloader.cpp: In member function 'void RFileDownloader::startDownloading(QUrl)':
Classes\RFileDownloader\RFileDownloader.cpp:20: error: 'url' has incomplete type
./Classes/RFileDownloader/RFileDownloader.h:9: error: forward declaration of 'struct QUrl'
Classes\RFileDownloader\RFileDownloader.cpp:24: error: '_url' was not declared in this scope
Classes\RFileDownloader\RFileDownloader.cpp:26: error: variable 'QNetworkRequest request' has initializer but incomplete type
Classes\RFileDownloader\RFileDownloader.cpp:26: error: '_url' was not declared in this scope
Classes\RFileDownloader\RFileDownloader.cpp:27: error: '_manager' was not declared in this scope
А если поставить в RFileDownloader.h обратно includ'ы то все компилируется хорошо
Почему так происходит?