Header file gives a error
-
I'm making a UI in Qt and need to have input.h included in spel.h, when I use input.h in my mainwindow.h everything works but I also need him in my spel.h and then QT gives these errors:
@expected ')' before '' token Input.h R 9
ISO C++ forbids declaration of 'Form' with no type Input.h R 13
expected ';' before '' token Input.h R13 @The input.h file:
@#ifndef INPUT_H
#define INPUT_H
#include "form.h"class Input
{public:
Input(Form * pointer):speler(pointer){}
int geefGoederenPopup(void);private:
Form * speler;
};#endif // INPUT_H
@form.h
@#ifndef FORM_H
#define FORM_H#include <QWidget>
#include "mainwindow.h"namespace Ui {
class Form;
}class Form : public QWidget
{
Q_OBJECTpublic:
explicit Form(QWidget *parent = 0);
int geefGoederen(void);
~Form();private:
Ui::Form *ui;
};#endif // FORM_H
@Can someone help please? How can I have in Spel.h a pointer to my input , because I can't include them I've got a big problem.
Kind regards,
-
Form is definetly not a type for input.h. Obviously, because it is declared in Ui namespace. Try writing Ui::Form instead.
-
[quote author="Kxyu" date="1321904866"]Form is definetly not a type for input.h. Obviously, because it is declared in Ui namespace. Try writing Ui::Form instead.[/quote]
His class is also named Form ;-)
You could remove the #include form.h from input.h and use a forward declaration:
@
class Form;
@ -
But even with the #include, the pointer type should be known. The code looks ok to me. Something different must be going wrong.