ocds
ocds

Reputation: 13

QT plugins compilation issue

I have a serious issue with QtPlugin. I try to build a plugin from an interface, named dictionary:

class dictionary
{
private:
   ... some private members
public:
   ~dictionary();

   ... some no virtual methods

   virtual void collectData()=0;
   virtual void collectOperator()=0;
   virtual void collectControl()=0;
};

QT_BEGIN_NAMESPACE
Q_DECLARE_INTERFACE(CDictionnary, "shinoe.cameleon.dictionary/2.0")
QT_END_NAMESPACE

I have implemented dictionary in a blankdictionary class declared like this (blankdictionary.h) in a blankdictionary project.

The .pro file:

!include(../../../configuration.pri)

QT       += core gui

TARGET = blanktarget
TEMPLATE = lib
CONFIG += plugin

#dictionary interface includes
!include(../../../machine/kernel/includekernel.pri)

SOURCES += blankdictionary.cpp
HEADERS += blankdictionary.h

The blankdictionary.h file:

class blankdictionary : public dictionary {
   Q_OBJECT
   Q_INTERFACES(dictionary)
public:
   blankdictionary();
   void collectData();
   void collectOperator();
   void collectControl();
};

At the end of my blankdictionary.cpp file I have:

QT_BEGIN_NAMESPACE
Q_EXPORT_PLUGIN2(blanktarget, blankdictionary)
QT_END_NAMESPACE

At compile, it returns this error:

blankdictionary.cpp: In function 'QObject* qt_plugin_instance()':
blankdictionary.cpp:20: error: no match for 'operator=' in '_instance = (operator new(44u), (<statement>, ((blankdictionary*)<anonymous>)))'
c:\QtSDK\Desktop\Qt\4.7.4\mingw\include/QtCore/qpointer.h:65: note: candidates are: QPointer<T>& QPointer<T>::operator=(const QPointer<T>&) [with T = QObject]
c:\QtSDK\Desktop\Qt\4.7.4\mingw\include/QtCore/qpointer.h:67: note:                 QPointer<T>& QPointer<T>::operator=(T*) [with T = QObject]

any idea?

Thanks in advance !

Upvotes: 1

Views: 426

Answers (1)

cmannett85
cmannett85

Reputation: 22346

Another problem (as well as the one you have mentioned in your comment), is that you have declared the Q_OBJECT macro in the blankdictionary class, but then not derived it from QObject.

Upvotes: 2

Related Questions