头文件给出错误

时间:2011-11-21 16:14:15

标签: c++ qt

我在Qt中创建了一个UI,并且需要在spel.h中包含input.h,当我在mainwindow.h中使用input.h时一切正常但我还需要他在我的spel.h然后QT给出了这些错误:

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   

我和我的朋友现在正在寻找2个小时但仍然不明白为什么会出错。包括警卫一切都好。

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

1 个答案:

答案 0 :(得分:2)

form.h是否包含input.h?如果是这样,您有一个循环包含问题,使用包含保护无法解决。但无论如何,您可以转发声明Form而不是包含其头文件。其实我很确定能解决这个问题。

相关问题