Results 1 to 5 of 5

Thread: Compilation error: "field 'xxx' has incomplete type"

  1. #1
    Join Date
    Jun 2007
    Posts
    8
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Compilation error: "field 'xxx' has incomplete type"

    Hi, I'm trying to compile a program but one of the headers is giving me an error.
    The header:
    Qt Code:
    1. #include "ui_DAQDialog.h"
    2. #include <QDialog>
    3. #include <QMap>
    4. #include <QTime>
    5. #include "QCard"
    6.  
    7. class DAQDialog: public QDialog, public Ui::DAQDialog {
    8. Q_OBJECT
    9.  
    10. public:
    11. DAQDialog(QWidget *parent = 0, QCard *card0 = 0);
    12.  
    13. QMap<double, double> data;
    14.  
    15. private slots:
    16. void doDAQ();
    17.  
    18. private:
    19. QCard *Card;
    20. QTime timer;
    21. QTime waiter;
    22. };
    To copy to clipboard, switch view to plain text mode 

    The compilation error:
    Qt Code:
    1. DAQDialog.h:40: error: field 'data' has incomplete type
    To copy to clipboard, switch view to plain text mode 

    Thanks,

    Fedcer

  2. #2
    Join Date
    Mar 2006
    Location
    The Netherlands
    Posts
    300
    Thanks
    9
    Thanked 29 Times in 29 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Re: Compilation error: "field 'xxx' has incomplete type"

    The 'data' field on line 13 seems ok to me. (Though public, which is considered bad style).

    Could you give the whole file? So we can see what line 40 actually is?
    "The strength of a civilization is not measured by its ability to wage wars, but rather by its ability to prevent them." - Gene Roddenberry

  3. #3
    Join Date
    Jun 2007
    Posts
    8
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Compilation error: "field 'xxx' has incomplete type"

    Here you have the complete file. As you can see line 40 is the declaration of data.

    Thanks for the advice of not making data public. I know it's not the best thing to do and I was in fact about to write a public function that returned it to me, as it is usually done, when I enconutered myself with this problem.
    Attached Files Attached Files

  4. #4
    Join Date
    Mar 2006
    Location
    The Netherlands
    Posts
    300
    Thanks
    9
    Thanked 29 Times in 29 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Re: Compilation error: "field 'xxx' has incomplete type"

    Yes, I see. (The GPL notice takes a lot of space.)

    Sorry, but I don't see why that file would produce that error. Are you sure QMap was included properly? Did the compiler say anything else?
    "The strength of a civilization is not measured by its ability to wage wars, but rather by its ability to prevent them." - Gene Roddenberry

  5. #5
    Join Date
    Jun 2007
    Posts
    8
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Compilation error: "field 'xxx' has incomplete type"

    No, the compiler doesn't give any other error nor warning.
    About QMap not being properly included I don't see how that could be possible since I'm doing "#include <QMap>" at the beginning of the file. I even tried removing QMap and all other specific includes and do an include of QtGui but the error remains.

    EDIT: Well, I tried changing QMap<double, double> to QMap<int, double> and the program compiled fine. However I was sure that both types could be the same since I had already done it before. So, I tried changing to QMap<int, int> and it again compiled. Returned back to QMap<double, double> and gives me again the compilation error. Any ideas ?
    Last edited by fedcer; 27th July 2007 at 15:34.

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.