PDA

View Full Version : Compilation error: "field 'xxx' has incomplete type"



fedcer
26th July 2007, 22:23
Hi, I'm trying to compile a program but one of the headers is giving me an error.
The header:


#include "ui_DAQDialog.h"
#include <QDialog>
#include <QMap>
#include <QTime>
#include "QCard"

class DAQDialog: public QDialog, public Ui::DAQDialog {
Q_OBJECT

public:
DAQDialog(QWidget *parent = 0, QCard *card0 = 0);

QMap<double, double> data;

private slots:
void doDAQ();

private:
QCard *Card;
QTime timer;
QTime waiter;
};


The compilation error:


DAQDialog.h:40: error: field 'data' has incomplete type


Thanks,

Fedcer

Michiel
26th July 2007, 22:42
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?

fedcer
27th July 2007, 13:51
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.

Michiel
27th July 2007, 14:52
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?

fedcer
27th July 2007, 15:01
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 ?