PDA

View Full Version : QtNetwork error by compile MingW qt4.2



patrik08
26th October 2006, 13:41
the same application i can compile on qt4.1..... run ok! on qt4.2 i found this error....

from gui_main_final.cpp:9:
E:/qt4/include/QtNetwork/../../src/network/qnetworkinterface.h:97: error: expect
ed `,' or `...' before "struct"
mingw32-make[2]: *** [release\gui_main_final.o] Error 1
mingw32-make[2]: Leaving directory `E:/v7/CMS_SRC_5'
mingw32-make[1]: *** [release] Error 2
mingw32-make[1]: Leaving directory `E:/v7/CMS_SRC_5'
mingw32-make: *** [sub-CMS_SRC_5-make_default] Error 2




E:\qt4\src\network\qnetworkinterface.h

InterfaceFlags flags() const; /* line 80 */
QString hardwareAddress() const;
QList<QNetworkAddressEntry> addressEntries() const;

static QNetworkInterface interfaceFromName(const QString &name);
static QNetworkInterface interfaceFromIndex(int index);
static QList<QNetworkInterface> allInterfaces();
static QList<QHostAddress> allAddresses();

private:
friend class QNetworkInterfacePrivate;
QSharedDataPointer<QNetworkInterfacePrivate> d;
};

Q_DECLARE_OPERATORS_FOR_FLAGS(QNetworkInterface::I nterfaceFlags)

#ifndef QT_NO_DEBUG_STREAM
Q_NETWORK_EXPORT QDebug operator<<(QDebug debug, const QNetworkInterface &interface); /* line 97 */
#endif

QT_END_HEADER

#endif




waht i must chanche to compile .... ?

Note: i use -static on window ... same as http://wiki.qtcentre.org/index.php?title=Building_static_applications

jpn
26th October 2006, 14:50
Since it used to compile with 4.1, you have


QT += network

in .pro, right?

patrik08
26th October 2006, 15:09
Since it used to compile with 4.1, you have

in .pro, right?

Sure .... is inside......

if i remove #include <QtNetwork>
and insert or replace by only #include <QHttp>

so can can compile .....

But i like write the family group to include all
QTCore ... QTGui eccc... & QtNetwork ...

only on this class a loop do get - download file...




#ifndef GETFILE_H
#define GETFILE_H


#include <QObject>
#include <QtGui>
#include <QtNetwork>
/////// #include <QHttp>

class GetFile : public QObject
{
Q_OBJECT
//
public:
QFile *file;
QHttp *http;
int httpGetId;
int onlist;
/* stop declared */
GetFile()
{
}
void RequestFile( QString url , QString savelocalfile , int process )
{
onlist = process + 1;
QUrl urls(url);
file = new QFile(savelocalfile);

if (!file->open(QIODevice::WriteOnly)) {
emit ErrorGetFile(QString("Unable to save the file %1: %2.").arg(savelocalfile,file->errorString()));
delete file;
file = 0;
return;
}

http = new QHttp(this);
http->setHost(urls.host(),80);
httpGetId = http->get(urls.path(), file);
connect(http, SIGNAL(dataReadProgress(int, int)),this, SLOT(HProgress(int, int)));
connect(http, SIGNAL(requestFinished(int, bool)),this, SLOT(httpRequestFinished(int, bool)));
}

signals:
void ErrorGetFile( QString e );
void ReadStatus( int f , int e );
void MakeNext( int f );
public slots:
void HProgress( int full , int maked )
{
emit ReadStatus(full,maked);
}
void httpRequestFinished( int requestId, bool error )
{
if (requestId != httpGetId) {
return;
}
file->close();

if (error) {
file->remove();
emit ErrorGetFile(QString("Download failed: %1.").arg(http->errorString()));
} else {
emit MakeNext(onlist);
}
}


};
//
#endif // GETFILE_H