Hi,

I am writing a diagramming object to use in a graphics scene. It must be capable of emitting some signals, so I derived it from QGraphicsObject.

When I build my program, I get a linker error saying "error: unresolved external symbol "public: virtual struct QMetaObject const * __thiscall CmgDiagram::metaObject(void)const " ...". This is typically when moc isn't executed to generate the extra methods for the class. There is no moc_... file in my build output directory either.

This is the definition of my class :

Qt Code:
  1. class CmgDiagram : public QGraphicsObject
  2. {
  3. Q_OBJECT
  4.  
  5. public:
  6. CmgDiagram(QGraphicsScene *pScene, QGraphicsObject * parent = 0);
  7.  
  8. QRectF boundingRect() const;
  9. void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
  10.  
  11. CmgDiagramItem *getItem( QString sPath );
  12. void WriteXML( QXmlStreamWriter *pXML );
  13.  
  14. private:
  15. QGraphicsScene *m_pScene;
  16. CmgDiagramItem *m_pMainItem;
  17.  
  18. private slots:
  19. void selectionChanged( void );
  20. };
To copy to clipboard, switch view to plain text mode 

Why doens't this work ?

MOC runs just fine for another class in the same project that is derived from QGraphicsView.

Best regards,
Marc