问题的症结找到了,因为我是用的Win下的MingW+Qt4,所以某些程序就必须在.pro文件里加上一句
- win32:DEFINES += QT_DLL QWT_DLL
那个会导致出错的头文件代码如下:
- #ifndef MYPLOT_H
- #define MYPLOT_H
- #include <qwt_plot.h>
- using namespace std;
- class QwtPlotCurve;
- class MyPlot: public QwtPlot
- {
- Q_OBJECT
- public:
- MyPlot(QWidget *parent=NULL);
- virtual ~MyPlot(){}
- public slots:
- void setposition(double position);
- private:
- void showData(double *frequency, double *amplitude,
- double *phase, int count);
-
- QwtPlotCurve *d_crv1;
- QwtPlotCurve *d_crv2;
- };
- #endif // MYPLOT_H
现在的问题是编译不会报错,但是在Windows下运行编译出来的程序时会报:
而删除掉里面的Q_OBJECT和public slots:两行,且在其它文件的代码中删掉与之相关的connect语句后则程序可以正常运行,不知道是什么原因?
[ 此贴被chwoozy在2006-05-25 17:19重新编辑 ]