Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/128.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ 头文件给出了错误_C++_Qt - Fatal编程技术网

C++ 头文件给出了错误

C++ 头文件给出了错误,c++,qt,C++,Qt,我在Qt中创建一个UI,当我在主窗口中使用input.h时,需要在spel.h中包含input.h。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 我和我的朋友现在正

我在Qt中创建一个UI,当我在主窗口中使用input.h时,需要在spel.h中包含input.h。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个小时,但仍然不知道为什么会出现错误。包括警卫,一切都好

投入.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

form.h
是否包括
input.h
?如果是这样,您就有一个循环include问题,不能用include保护来解决。但在任何情况下,您都可以转发声明表单,而不包括其头文件。实际上,我很确定这会解决问题。

什么是form.h?另外,请把代码放在你的实际问题中,而不是指向pastebin网站的链接。你能给我们看一下
form.h
?使用前向声明可能会解决您眼前的问题,但我怀疑您的表单类声明存在问题。我的责任在于您忘记表单类声明末尾的分号,但在看到Form.h文件之前,很难说。Form.h文件看起来不错();我已经删除了我的答案,因为它无法解决您的问题。在任何情况下,空构造函数定义后面都有多余的分号。没有form.h不包括input.h。提前声明类也不起作用。
mainwindow.h
包括
input.h
,其中包括
form.h
,其中包括<代码>主窗口.h。没有自行车吗?此外,为什么要在
form.h
中包含
mainwindow.h
,可能您没有粘贴整个代码,或者它实际上是无用的?