Following bit of code is throwing error. I have no idea why. Can anyone shed some light? All codes are on different files.
#ifndef MAINSESSION_H
#define MAINSESSION_H
#include "sessionsuper.h"
#include "mainwindow.h"
class MainSession : public SessionSuper
{
public:
MainSession();
private:
};
#include "mainsession.h"
MainSession::MainSession()
{
}
#endif // MAINSESSION_H
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include "mainsession.h"
#include <QMainWindow>
namespace Ui {
class MainWindow;
}
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
explicit MainWindow(QWidget *parent = 0);
~MainWindow();
private:
Ui::MainWindow *ui;
MainSession *ms; //Error here
};
#endif // MAINWINDOW_H
#include "mainwindow.h"
#include "ui_mainwindow.h"
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
//ms=new MainSession(this);
}
MainWindow::~MainWindow()
{
delete ui;
}
#ifndef SESSIONSUPER_H
#define SESSIONSUPER_H
class SessionSuper
{
public:
SessionSuper();
};
#endif // SESSIONSUPER_H
#include "sessionsuper.h"
SessionSuper::SessionSuper()
{
}
Error:
d:\qtsrc\untitled4\mainwindow.h:20: error: C2143: syntax error : missing ';' before '*'
d:\qtsrc\untitled4\mainwindow.h:20: error: C4430: missing type specifier - int assumed. Note: C++ does not support default-int d:\qtsrc\untitled4\mainwindow.h:20: error: C4430: missing type specifier - int assumed. Note: C++ does not support default-int
Am using Qt+msvc10.0 compiler.
Update:-
#ifndef MAINSESSION_H
#define MAINSESSION_H
#include "sessionsuper.h"
#include "mainwindow.h"
class MainSession : public SessionSuper
{
public:
MainSession(MainWindow*);
private:
MainWindow *mw;
};
#endif // MAINSESSION_H
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include "mainsession.h"
#include <QMainWindow>
namespace Ui {
class MainWindow;
}
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
explicit MainWindow(QWidget *parent = 0);
~MainWindow();
private:
Ui::MainWindow *ui;
MainSession *ms;
};
#endif // MAINWINDOW_H
#ifndef SESSIONSUPER_H
#define SESSIONSUPER_H
class SessionSuper
{
public:
SessionSuper();
};
#endif // SESSIONSUPER_H
#include "mainwindow.h"
#include <QApplication>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
MainWindow w;
w.show();
return a.exec();
}
#include "mainsession.h"
MainSession::MainSession(MainWindow mss)
{
mw=mss;
}
#include "mainwindow.h"
#include "ui_mainwindow.h"
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
//ms=new MainSession(this);
}
MainWindow::~MainWindow()
{
delete ui;
}
#include "sessionsuper.h"
SessionSuper::SessionSuper()
{
}
Errors:- a lot more but of same type