Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Compiling QtCreator 3.4.2 with Qt 5.5.0 reports error on qsingleapplication.h: using of incomplete class "QSharedMemory"



  • Hello everyone !
    I'm compiling QtCreator v3.4.2 with Qt v5.5.0. The compiler I used is MinGW-w64 4.9.2 in MSYS2. But while compiling the cpp files who includes file qsingleapplication.h at path<QtCreator_Src_Dir>/src/shared/qtsingleapplication, the compiler report errors such as using of incomplete class 'QSharedMemory' ... blablabla.

    I'm also tried to compile this version of QtCreator with Qt v5.4.2, and using the same compiler. The compiling error didn't appear. So I think maybe there is something wrong with Qt v5.5.0? But there are too many difference between the source code of Qt5.4.2 and Qt5.5.0, and I can't find the code which caused error. Could anyone help? Thx!



  • Newest progress:
    Today after many times of compiling and testing, I found this error was caused by the definition of macro QT_NO_SHAREDMEMORY, it made the definition of class QSharedMemory unavailable in header file <QT_INSTALL_DIR>/include/QtCore/qsharedmemory.h.
    The macro QT_NO_SHAREDMEMORY is defined in qconfig.h, which is generated in my custom-building progress of Qt5.5.0. But the qconfig.h in official version of Qt5.5.0 does not contains the definition of that macro. So I guess whether the configure scripts generated this macro, because qconfig.h is generated by the scripts in file <QT_SRC_DIR>/qtbase/configure.
    After many times of testing, I found there is a part of script code which is very strange and make me confused. this part of script lies in line 4453 - 4463:

    # check IPC support
    if ! compileTest unix/ipc_sysv "ipc_sysv" ; then
        # SYSV IPC is not supported - check POSIX IPC
        if compileTest unix/ipc_posix "ipc_posix" ; then
            QCONFIG_FLAGS="$QCONFIG_FLAGS QT_POSIX_IPC"
        else
            if [ "$XPLATFORM_ANDROID" = "no" ] ; then
                QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_SYSTEMSEMAPHORE QT_NO_SHAREDMEMORY"
            fi
        fi
    fi
    

    As mentioned above, if the script found the compileTest of ipc_posix failed, and if the target platform is not android, then variable QCONFIG_FLAGS will be appended with QT_NO_SYSTEMSEMAPHORE and QT_NO_SHAREDMEMORY. Therefore the scripts between line 6662 and 6693 will generate the definition of macro QT_NO_SHAREDMEMORY in file qconfig.h.

    I'm doubted that why the SYSTEMSEMAPHORE and SHAREDMEMORY should be disabled while the target platform is not android. I guess maybe it is a clerical error and the code if [ "$XPLATFORM_ANDROID" = "no" ] ; should be if [ "$XPLATFORM_ANDROID" != "no" ] ;. But I'm not sure, could any one tell me?