1
DoubleClickEvent를 추가하는 QLabel 하위 클래스를 만들고 있습니다. 나는 다음과 같은 것을 만들었지 만 이상한 링커 에러가 발생했다. 누군가 내가 잘못한 것을 지적 할 수 있을까? 나는 이러한 오류를 얻을 이유doubleclick 이벤트로 QLabel을 만드는 링커 오류
image_label.obj : error LNK2001: unresolved external symbol "public: virtual struct QMetaObject const * __thiscall image_label::metaObject(void)const " ([email protected][email protected]@[email protected]@XZ)
image_label.obj : error LNK2001: unresolved external symbol "public: virtual void * __thiscall image_label::qt_metacast(char const *)" ([email protected][email protected]@[email protected])
image_label.obj : error LNK2001: unresolved external symbol "public: virtual int __thiscall image_label::qt_metacall(enum QMetaObject::Call,int,void * *)" ([email protected][email protected]@[email protected]@@[email protected])
image_label.obj : error LNK2019: unresolved external symbol "protected: void __thiscall image_label::doubleClicked(void)" ([email protected][email protected]@IAEXXZ) referenced in function "protected: virtual void __thiscall image_label::mouseDoubleClickEvent(class QMouseEvent *)" ([email protected][email protected]@[email protected]@@Z)
아무도 도와 드릴까요 : 내가 컴파일 할 때
//Header
#ifndef IMAGE_LABEL_H
#define IMAGE_LABEL_H
#include <QLabel>
#include <QMouseEvent>
class image_label : public QLabel
{
Q_OBJECT
public:
image_label(QWidget* parent = 0);
~image_label();
signals:
void doubleClicked();
protected:
void mouseDoubleClickEvent(QMouseEvent * e);
};
#endif
//CPP
#include "image_label.h"
#include <QMouseEvent>
image_label::image_label(QWidget* parent) : QLabel(parent)
{
}
image_label::~image_label()
{
}
void image_label::mouseDoubleClickEvent(QMouseEvent* e)
{
if (e->button() == Qt::LeftButton)
{
emit doubleClicked();
QLabel::mouseDoubleClickEvent(e);
}
}
나는 다음과 같은 링커 오류를 얻을?
QT에는 없지만 이러한 연결 오류가 발생했습니다 (예 : http://stackoverflow.com/questions/10006711/eclipse- c-project-not-building-constructor-destructor-issue/10007510 # 10007510) 정의하지 않은 모든 가상 함수. 가장 가능성이 있지만, 생각할 가치가 있습니다. –