Qt 4.7 找不到符号错误
Qt 4.7 Symbols not found error
谁能向我解释这个错误?似乎这是moc发生的错误:
Undefined symbols:
make: Leaving directory `/Users/Dylan/Documents/programming/qt/Clock-build-desktop'
"ClockDelegate::ClockDelegate(QObject*)", referenced from:
AnalogClockDelegate::AnalogClockDelegate(QObject*)in AnalogClockDelegate.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
make: *** [Clock.app/Contents/MacOS/Clock] Error 1
The process "/usr/bin/make" exited with code 2.
Error while building project Clock (target: Desktop)
When executing build step 'Make'
时钟代表:
#ifndef CLOCKDELEGATE_H
#define CLOCKDELEGATE_H
#include <QObject>
class QTime;
class QWidget;
class ClockDelegate : public QObject
{
Q_OBJECT
public:
explicit ClockDelegate(QObject *parent);
virtual void paintClock(QWidget *, QTime *) = 0;
};
#endif // CLOCKDELEGATE_H
模拟时钟代表:
#ifndef ANALOGCLOCKDELEGATE_H
#define ANALOGCLOCKDELEGATE_H
#include <QColor>
#include <QPoint>
#include "ClockDelegate.h"
class QWidget;
class AnalogClockDelegate : public ClockDelegate
{
Q_OBJECT
public:
explicit AnalogClockDelegate(QObject *parent);
void paintClock(QWidget *, QTime *);
private:
void setupClockHands();
void drawClockSurface(QWidget *clockView, QTime *);
void drawHourComponent(QWidget *clockView);
void drawMinuteComponent(QWidget *clockView, QTime *);
void drawSecondComponent(QWidget *clockView, QTime *);
QPoint m_center;
QPoint m_hourHand[3];
QPoint m_minuteHand[3];
QPoint m_secondHand[2];
QColor m_hourColor;
QColor m_minuteColor;
QColor m_secondColor;
QColor m_clockFaceColor;
};
#endif // ANALOGCLOCKDELEGATE_H
我认为你错过了"public"关键字,假设ClockDelegate是一个QObject。否则,您不是从 QObject 派生的,因此无法使用Q_OBJECT。
class AnalogClockDelegate : public ClockDelegate
相关文章:
- 在C++中使用内联方法时出现未定义的符号错误
- 当 lib 已添加到其他依赖项时,如何在 VS 中调试未解析的外部符号错误
- 函数指针给我"重新声明为不同类型的符号"错误
- "byte":使用Crypto++和Windows SDK时出现不明确的符号错误
- 函数路径追加上未解决的外部符号错误
- 作为成员的静态类模板实例会导致未解析的外部符号错误
- C++ XCODE ld:找不到体系结构x86_64 clang 的符号:错误:链接器命令失败,退出代码为 1(使用 -
- 共享库中使用"使用命名空间"定义的符号错误
- 在FreesWitch中使用AWS C SDK加载模块时未定义的符号错误
- 在 Mac 上C++编译代码时处理“dyld:惰性符号绑定失败:找不到符号”错误
- C++编译错误LNK2019:未解决的外部符号错误
- VTK / ITK/ QT - 未解决的外部符号错误 (LNK2001)
- QT创建者:简单程序未解决的外部符号和外部符号错误
- C++编译错误:ld:找不到体系结构x86_64 clang 的符号:错误:链接器命令失败,退出代码为 1(使用 -v
- 标准::字符串::空的未定义符号错误;Mac OS High Sierra 上的 c++ 标准方法链接错误
- ld:找不到体系结构x86_64 clang 的符号:错误:链接器命令失败,退出代码为 1(使用 -v 查看调用)
- 由于使用未签名的INT,因此在Variadic模板C 上未解决的外部符号错误
- OSX MOJAVE -LD:架构X86_64 clang找不到符号:错误:链接器命令失败,出口代码1
- 使用从WINRT网格类派生的抽象类时,Casttobase未解决的外部符号错误
- LD:架构x86_64 clang找不到符号:错误:链接器命令失败,出口代码1(使用-v to See