Qt不承认声明的类

时间:2013-08-13 10:26:23

标签: qt compiler-errors

我使用Qt 4.6.3为FriendlyARM编写应用程序。我试图将2个指针(指向类axesParam1mainWin)传递给当前的类localTime但是会​​出现以下错误:

localtime.h:17: error: 'axesParam1' has not been declared
localtime.h:18: error: 'mainWin' has not been declared
localtime.h:26: error: ISO C++ forbids declaration of 'axesParam1' with no type
localtime.h:26: error: expected ';' before '*' token
localtime.h:27: error: ISO C++ forbids declaration of 'mainWin' with no type
localtime.h:27: error: expected ';' before '*' token
In file included from trackinputstatus.h:5,
from trackinput.h:5,
from mainwin.h:8,
from geoparam.h:5,
from axesparam3.h:5,
from axesparam2.h:5,
from axesparam1.h:5,
from main.cpp:14:
trackparamstatus.h:16: error: 'mainWin' has not been declared
trackparamstatus.h:24: error: ISO C++ forbids declaration of 'mainWin' with no type
trackparamstatus.h:24: error: expected ';' before '*' token
main.cpp: In function 'int main(int, char**)':
main.cpp:52: error: no matching function for call to 'localTime::setChildren(axesParam1*)'
localtime.h:17: note: candidates are: void localTime::setChildren(int*)
main.cpp:61: error: no matching function for call to 'localTime::setHome(mainWin*)'
localtime.h:18: note: candidates are: void localTime::setHome(int*)
main.cpp:62: error: no matching function for call to 'trackParamStatus::setHome(mainWin*)'
trackparamstatus.h:16: note: candidates are: void trackParamStatus::setHome(int*)

我没有声明setChildern接受int*作为参数,为什么它坚持int*

我已经包含了头文件localtime.h

#ifndef LOCALTIME_H
#define LOCALTIME_H

#include  <QWidget>
#include "axesparam1.h"
#include "mainwin.h"

namespace Ui {
    class localTime;
}

class localTime : public QWidget {
    Q_OBJECT
public:
    localTime(QWidget *parent = 0);
    ~localTime();
    void setChildren(axesParam1 *);
    void setHome(mainWin *);


protected:
    void changeEvent(QEvent *e);

private:
    Ui::localTime *ui;
    axesParam1 *P1;
    mainWin *w;

};

#endif // LOCALTIME_H

1 个答案:

答案 0 :(得分:0)

你看起来太过分了。在您查看setChildern之前,您应该查看axesparam1和/或mainwin。

  

localtime.h:17:错误:'axesParam1'尚未声明   localtime.h:18:错误:'mainWin'尚未声明

您之前有一些syntex错误。 setChildern只是一些后续错误。