Results 1 to 7 of 7

Thread: QtcoSocket -QtNetwork Compile error

  1. #1
    Join Date
    May 2010
    Posts
    46
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Windows

    Exclamation QtcoSocket -QtNetwork Compile error

    Hi,
    I have this kind of problem:

    I have two class and both are subclass of qObject.
    The first include onlly my personale include, the second class include QTcpServer and include Qt networnk (#include <QtNetwork>).

    I want to be able to include the first class in the second class but I have this error:

    : #error : qfile.h must be included before any header file that defines open

    How i can solveed it?

    Bye, Darui

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,018 Times in 4,794 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QtcoSocket -QtNetwork Compile error

    Change the order of includes.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    May 2010
    Posts
    46
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QtcoSocket -QtNetwork Compile error

    If I change the order of include I have this error:

    : error C2039: '_write' : is not a member of 'QTcpSocket'

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,018 Times in 4,794 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QtcoSocket -QtNetwork Compile error

    Please show us your includes.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  5. #5
    Join Date
    May 2010
    Posts
    46
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QtcoSocket -QtNetwork Compile error

    Ok,
    this is a piece of my first header:

    Qt Code:
    1. A.h
    2.  
    3. #ifndef A_H
    4. #define A_H
    5.  
    6. #include <QTcpServer>
    7. #include <QTcpSocket>
    8. class B;
    9.  
    10. class A: public QObject
    11. {
    12. .. .. ..
    13. };
    14. #endif
    To copy to clipboard, switch view to plain text mode 

    and the implementation is:
    Qt Code:
    1. A.cpp
    2. #include "A.h"
    3. #include <QtNetwork>
    4.  
    5. #include "B.h"
    6.  
    7. ..
    8. ..
    9. ..
    To copy to clipboard, switch view to plain text mode 

    Where B is:

    Qt Code:
    1. B.h
    2. #ifndef B
    3. #define B
    4.  
    5. #include "HostInfo.h"
    6.  
    7. class B : public QObject
    8. {
    9. Q_OBJECT
    To copy to clipboard, switch view to plain text mode 

    the implementation is
    Qt Code:
    1. #include "B.h"
    2.  
    3. ..
    4. ..
    5. ..
    To copy to clipboard, switch view to plain text mode 

    while the class HostInfo is:

    Qt Code:
    1. #ifndef HOSTINFO_H
    2. #define HOSTINFO_H
    3.  
    4. #include "QTcpSocket"
    5.  
    6. typedef struct Host{
    7. QTcpSocket* pxSocket;
    8. }HostInfo;
    9.  
    10. #endif
    To copy to clipboard, switch view to plain text mode 


    Thanks

  6. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,018 Times in 4,794 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QtcoSocket -QtNetwork Compile error

    Is it possible for you to prepare a minimal compilable example reproducing the problem?

    Also: which exactly include line does the error refer to?
    Last edited by wysota; 14th July 2010 at 09:55.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  7. #7
    Join Date
    May 2010
    Posts
    46
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QtcoSocket -QtNetwork Compile error

    I have solved my problem.

    The problem is another propretary librabry that doesn't support Qt.
    I have solved whit another design for my application.

    Thanks and sorry if this is only my personal error.

    Bye, Dax

Similar Threads

  1. no compile error, but error on run with QMenu QAction
    By sincnarf in forum Qt Programming
    Replies: 4
    Last Post: 4th May 2011, 11:05
  2. No error from QTNetwork if network goes off
    By Ganesh in forum Qt Programming
    Replies: 6
    Last Post: 27th November 2008, 21:29
  3. Compile error with Qt3.2.3
    By redsprite in forum Installation and Deployment
    Replies: 1
    Last Post: 19th January 2007, 10:36
  4. QtNetwork error by compile MingW qt4.2
    By patrik08 in forum Qt Programming
    Replies: 2
    Last Post: 26th October 2006, 15:09
  5. error compile
    By mickey in forum General Programming
    Replies: 5
    Last Post: 27th June 2006, 22:21

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
  •  
Qt is a trademark of The Qt Company.