Results 1 to 20 of 23

Thread: error compile

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Posts
    976
    Thanks
    53
    Qt products
    Qt3
    Platforms
    Windows

    Thumbs up Re: error compile [SOLVED]

    Hi,
    I change including <mywidget.h> from declaration to implementation (in qtDesigner) and now compile. But Why?
    Thanks
    Last edited by mickey; 28th February 2006 at 23:46.
    Regards

  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: error compile

    And what is mywidget.h? Could we see its contents? Are you by any chance including mainwindow.h there?

  3. #3
    Join Date
    Jan 2006
    Posts
    976
    Thanks
    53
    Qt products
    Qt3
    Platforms
    Windows

    Default Re: error compile

    Qt Code:
    1. ifndef MYWIDGET_H
    2. #define MYWIDGET_H
    3. #include <qgl.h>
    4. #include <qpoint.h>
    5. #include <qtimer.h>
    6. #include "mainform.h"
    7. class MainForm;
    8. #define BUFSIZE 512
    9.  
    10. class MyWidget : public QGLWidget
    11. {
    12. Q_OBJECT
    13. public:
    14.  
    15. MyWidget( QWidget *parent = 0, const char *name = 0, const QGLWidget* shareWidget = 0);
    16. ~MyWidget();
    17. .........
    18. };
    To copy to clipboard, switch view to plain text mode 

    Is it #include "mainform.h" the problems? I need take it here... But wich is different between include in implem and in declaration? I thought it was the same for success of compile...
    Regards

  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: error compile

    Quote Originally Posted by mickey
    Is it #include "mainform.h" the problems?
    Probably yes.

    I need take it here...
    No you don't. Do you use methods defined there?
    But wich is different between include in implem and in declaration? I thought it was the same for success of compile...
    No. You should avoid including to much files in headers, because it slows down the compilation. But the reason of failure might be that qmake sees that it needs that included file in the current file, but that file is included in the other one, so it depends on it and thus it creates a cycle. Of course it might be something different, but you should try removing that include from the header file.

  5. #5
    Join Date
    Jan 2006
    Posts
    976
    Thanks
    53
    Qt products
    Qt3
    Platforms
    Windows

    Default Re: error compile

    Quote Originally Posted by wysota
    No you don't. Do you use methods defined there?
    yes I use members of mainform from here; But if I put it in implementation compile..
    [QUOTE=wysota]
    No. You should avoid including to much files in headers, because it slows down the compilation. [QUOTE]
    including much headers where? from QTdesigner? in implementation? in declarations? Or at begin of file by hand?

    thanks
    Regards

  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: error compile

    Quote Originally Posted by mickey
    including much headers where? from QTdesigner? in implementation? in declarations? Or at begin of file by hand?
    In header files. Because each file which includes that file will also include all the files including it and each time cpp has to parse them. That's why using precompiled headers results in such a big speed gain Parsing header files takes much time.

  7. #7
    Join Date
    Jan 2006
    Posts
    976
    Thanks
    53
    Qt products
    Qt3
    Platforms
    Windows

    Default Re: error compile

    Sorry but I have some problems with english also. Do you say me to put #incldue much more In implementation or implemention (from qtDesinger).
    And is this an help for speed:
    Qt Code:
    1. #ifndef MYWIDGET_H
    2. #define MYWIDGET_H
    3. .......
    To copy to clipboard, switch view to plain text mode 
    Thanks
    Regards

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.