Results 1 to 3 of 3

Thread: QtNetwork error by compile MingW qt4.2

  1. #1
    Join Date
    May 2006
    Posts
    788
    Thanks
    49
    Thanked 48 Times in 46 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default QtNetwork error by compile MingW qt4.2

    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


    Qt Code:
    1. E:\qt4\src\network\qnetworkinterface.h
    2.  
    3. InterfaceFlags flags() const; /* line 80 */
    4. QString hardwareAddress() const;
    5. QList<QNetworkAddressEntry> addressEntries() const;
    6.  
    7. static QNetworkInterface interfaceFromName(const QString &name);
    8. static QNetworkInterface interfaceFromIndex(int index);
    9. static QList<QNetworkInterface> allInterfaces();
    10. static QList<QHostAddress> allAddresses();
    11.  
    12. private:
    13. friend class QNetworkInterfacePrivate;
    14. QSharedDataPointer<QNetworkInterfacePrivate> d;
    15. };
    16.  
    17. Q_DECLARE_OPERATORS_FOR_FLAGS(QNetworkInterface::InterfaceFlags)
    18.  
    19. #ifndef QT_NO_DEBUG_STREAM
    20. Q_NETWORK_EXPORT QDebug operator<<(QDebug debug, const QNetworkInterface &interface); /* line 97 */
    21. #endif
    22.  
    23. QT_END_HEADER
    24.  
    25. #endif
    To copy to clipboard, switch view to plain text mode 

    waht i must chanche to compile .... ?

    Note: i use -static on window ... same as http://wiki.qtcentre.org/index.php?t...c_applications

  2. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: QtNetwork error by compile MingW qt4.2

    Since it used to compile with 4.1, you have
    QT += network
    in .pro, right?
    J-P Nurmi

  3. #3
    Join Date
    May 2006
    Posts
    788
    Thanks
    49
    Thanked 48 Times in 46 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QtNetwork error by compile MingW qt4.2

    Quote Originally Posted by jpn View Post
    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...


    Qt Code:
    1. #ifndef GETFILE_H
    2. #define GETFILE_H
    3.  
    4.  
    5. #include <QObject>
    6. #include <QtGui>
    7. #include <QtNetwork>
    8. /////// #include <QHttp>
    9.  
    10. class GetFile : public QObject
    11. {
    12. Q_OBJECT
    13. //
    14. public:
    15. QFile *file;
    16. QHttp *http;
    17. int httpGetId;
    18. int onlist;
    19. /* stop declared */
    20. GetFile()
    21. {
    22. }
    23. void RequestFile( QString url , QString savelocalfile , int process )
    24. {
    25. onlist = process + 1;
    26. QUrl urls(url);
    27. file = new QFile(savelocalfile);
    28.  
    29. if (!file->open(QIODevice::WriteOnly)) {
    30. emit ErrorGetFile(QString("Unable to save the file %1: %2.").arg(savelocalfile,file->errorString()));
    31. delete file;
    32. file = 0;
    33. return;
    34. }
    35.  
    36. http = new QHttp(this);
    37. http->setHost(urls.host(),80);
    38. httpGetId = http->get(urls.path(), file);
    39. connect(http, SIGNAL(dataReadProgress(int, int)),this, SLOT(HProgress(int, int)));
    40. connect(http, SIGNAL(requestFinished(int, bool)),this, SLOT(httpRequestFinished(int, bool)));
    41. }
    42.  
    43. signals:
    44. void ErrorGetFile( QString e );
    45. void ReadStatus( int f , int e );
    46. void MakeNext( int f );
    47. public slots:
    48. void HProgress( int full , int maked )
    49. {
    50. emit ReadStatus(full,maked);
    51. }
    52. void httpRequestFinished( int requestId, bool error )
    53. {
    54. if (requestId != httpGetId) {
    55. return;
    56. }
    57. file->close();
    58.  
    59. if (error) {
    60. file->remove();
    61. emit ErrorGetFile(QString("Download failed: %1.").arg(http->errorString()));
    62. } else {
    63. emit MakeNext(onlist);
    64. }
    65. }
    66.  
    67.  
    68. };
    69. //
    70. #endif // GETFILE_H
    To copy to clipboard, switch view to plain text mode 

Similar Threads

  1. Problem to compile with MinGW + Qt 4 + winpcap
    By jlbrd in forum Qt Programming
    Replies: 4
    Last Post: 4th May 2006, 16:32

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.