user1007522
user1007522

Reputation: 8118

Header file gives 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   

Me and my friend are searching for 2 hours right now and still don't see why it's giving errors. Include guards everything is okay.

Input.h:

#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

Upvotes: 0

Views: 251

Answers (1)

Dabbler
Dabbler

Reputation: 9873

Does form.h include input.h? If so, you have a cyclic include problem that can't be solved with an include guard. But in any case, you can forward declare Form instead of including its header file. Actually I'm pretty sure that will solve the problem.

Upvotes: 2

Related Questions