Can't find linker symbol for virtual table for 'QMutexLocker' value
-
I have a class which allows the user read/write access to a array.
mem.h
@
typedef std::auto_ptr<QByteArray> QByteArrayPtr;
class mem : public QObject
{
Q_OBJECT
public:
explicit mem(QObject *parent = 0) : QObject(parent ) {}
void CleanUp();qint32 Write (const QByteArray pbuf); QByteArrayPtr Read(const qint32 timeout = ULONG_MAX);
private:
QMutex mutex;
QWaitCondition cond;
QList<QByteArray*> pblock;// memory block};
@mem.c
@
void mem::CleanUp()
{
int size = 0;
int i;
QMutexLocker locker(&mutex);
size = pblock.size();
for (i=0;i<size;i++) {
QByteArray *pbuf = pblock.at(0);
pbuf->clear();
delete pbuf;
}
}qint32 mem::Write(const QByteArray pbuf)
{
qint32 writebytes = 0;
QMutexLocker locker(&mutex);if (pblock.size() >= 16) { return 0; } QByteArray *newpbuf = new QByteArray; *newpbuf = pbuf; pblock << newpbuf; writebytes = pbuf.size(); cond.wakeOne(); return writebytes;
}
QByteArrayPtr mem::Read(const qint32 timeout)
{
QByteArrayPtr block;
QMutexLocker locker(&mutex);
if (pblock.size() == 0) {
cond.wait(locker.mutex(), timeout);
}if (pblock.size() != 0) {
block.reset(pblock.at(0));
pblock.removeAt(0);
}
return block;
}
@after saving the data into mem i try to read them. But i got the error
can't find linker symbol for virtual table for 'QMutexLocker' value
QMutex::lock: Deadlock detected in thread 368
Do you have any ideas where i do wrong?
Thank you -
Are those two errors from the same run? Because if the symbol cannot be found, that is (dynamic) link time error, while the error from QMutex::lock() is a runtime error.
If they are from the same run, it looks like your app is picking up a different Qt library than you link your project with.