Reputation: 95
I'm trying to create two private variables type date on a class but i'm getting the error "field 'date1' has incomplete type 'QDate'". I made an empty test application to show the problem.
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
namespace Ui {
class MainWindow;
}
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
explicit MainWindow(QWidget *parent = 0);
~MainWindow();
private:
Ui::MainWindow *ui;
QDate date1; <<---- Problem here
QDate date2;
};
#endif // MAINWINDOW_H
Is there a special way to declare date variables?
Upvotes: 0
Views: 2534
Reputation: 167
After adding the header
#include <QDate>
you can initialize them like this:
QDate date1(1995,2,2);
Upvotes: 1