PDA

View Full Version : undefined symbol while loading plugin



qlands
8th August 2011, 14:15
Hi,

I have a plugin library (like the QT plug-and-paint example) that contains a series of QWidgets to enter data.

The interface of the plugin has a pure virtual fuction called QWidget* impMainModules::loadScreen(QString pluginName) that returns a widget bases on a plugin name.

All worked fine until I wanted to create a QtableModel to use in some of the widgets:


class fieldInRowModel : public QAbstractTableModel
{
Q_OBJECT
public:
fieldInRowModel(QObject *parent=0);
~fieldInRowModel();

int rowCount(const QModelIndex & parent = QModelIndex()) const;
int columnCount(const QModelIndex &parent = QModelIndex()) const;
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
void setDatabase (QSqlDatabase db);
private:
QSqlDatabase database;

};


Implemented as:


fieldInRowModel::fieldInRowModel(QObject *parent)
:QAbstractTableModel(parent)
{

}

fieldInRowModel::~fieldInRowModel()
{

}

int fieldInRowModel::rowCount(const QModelIndex &) const
{
return 0; //Test value
}

int fieldInRowModel::columnCount(const QModelIndex &) const
{
return 0; //Test value
}
QVariant fieldInRowModel::data(const QModelIndex &/*index*/, int /*role*/) const
{
return QVariant(); //Test value
}
void fieldInRowModel::setDatabase (QSqlDatabase db)
{
database = db;
}


fieldInRowModel is in a separate file called moduleclasses.h and cpp that are part of the plugin library project .

Now, with the inclusion of this class in the plugin library, I get the following error when the main application intents to load the plugin.


undefined symbol: _ZTV15fieldInRowModel


fieldInRowModel is internal for the library thus the main application should not know that it exists.

Any idea how to fix it?

Thanks a lot!
Carlos.

MarekR22
8th August 2011, 16:07
From plugin you are exposing only interfaces or types known to plugin user (application).
Apparently you are trying to expose from plugin to some application custom type: fieldInRowModel.
Type fieldInRowModel should be visible for application as QAbstractTableModel type, nothing more.

Dong Back Kim
9th August 2011, 01:57
QVariant fieldInRowModel::data(const QModelIndex &/*index*/, int /*role*/) const
{
return QVariant(); //Test value
}


I guess you might have put your code like that on purpose. Just double check you do aware your code has some problem right? You didn't specify the parameter name in signature of your function definition.

qlands
9th August 2011, 14:46
Hi,

The problem was related to the way I included some header files, so they were exposed to the plugin user.

Thanks.