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"
JohnYork last edited by
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
<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!
JohnYork last edited by
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
QSharedMemoryunavailable in header file
QT_NO_SHAREDMEMORYis defined in qconfig.h, which is generated in my custom-building progress of Qt5.5.0. But the
qconfig.hin 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.his generated by the scripts in file
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_posixfailed, and if the target platform is not
android, then variable
QCONFIG_FLAGSwill be appended with
QT_NO_SHAREDMEMORY. Therefore the scripts between line
6693will generate the definition of macro
I'm doubted that why the
SHAREDMEMORYshould 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?