Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Can't find linker symbol for virtual table for 'QMutexLocker' value

Can't find linker symbol for virtual table for 'QMutexLocker' value

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 Posters 3.2k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    Jaron
    wrote on last edited by
    #1

    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

    1 Reply Last reply
    0
    • M Offline
      M Offline
      miroslav
      wrote on last edited by
      #2

      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.

      Mirko Boehm | mirko@kde.org | KDE e.V.
      FSFE Fellow
      Qt Certified Specialist

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved