QSharedMemory::handle doesnt exist error [SOLVED]

  • I'm trying this bellow QT code :
    #include <QtCore/QCoreApplication>
    QSharedMemory g_objSharedMemory(QString("Shared Memory"));

    int main(int argc, char *argv[])
        QCoreApplication a(argc, argv);
            qDebug()<<"Shared memory is not attached !!!!trying to attach it\n ";
                qDebug()<<"Failed to attach shared memory to the process!!!!";
                return 0;
        return a.exec&#40;&#41;;

    I'm failed to attach the shared memory segment to the process. I'm building this code on windows xP
    I'm getting "QSharedMemory::handle doesnt exist error".
    How can i fix this error ?

  • Do you create this memory or it is created by other process?

  • oh ya. i got the problem. i didnt created the memory here. so i'm getting error

  • Good :) If you could please add to the title of post prefix [solved] so other people will know that you find answer.

  • i just added
    @ g_objSharedMemory.create(MEMORY_SIZE_BYTES) @
    in the 2nd line of main()

  • Thanks for your Post and Replies guyz... Even i too did the same Mistake trying without creating the memory. After seeing your replies i got to know it.. Thanks a lot...

    Thanks & Regards...

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.