Realloc definition conflict with QObject and C++ vector in Qt project ..
-
Hi.
I am working on one project where we am using third party library ptlib and opal.
We have ptlib and opal library working for both linux and windows. Our project is working fine in both Debug and Release build in Ubuntu 20.04 OS and same project is working with Windows Release build.
But whenever we are trying to build same code is Debug mode in Windows it is giving below,C:\Qt\5.15.2\msvc2015_64\include\QtCore/qvector.h(103): warning C4003: not enough actual parameters for macro 'realloc'
C:\Qt\5.15.2\msvc2015_64\include\QtCore/qvector.h(316): error C2059: syntax error: 'string'
C:\Qt\5.15.2\msvc2015_64\include\QtCore/qvector.h(327): note: see reference to class template instantiation 'QVector<T>' being compiled
C:\Qt\5.15.2\msvc2015_64\include\QtCore/qvector.h(316): error C3254: 'QVector<T>': class contains explicit override 'Reallocate' but does not derive from an interface that contains the function declaration
C:\Qt\5.15.2\msvc2015_64\include\QtCore/qvector.h(316): error C2838: 'Reallocate': illegal qualified name in member declaration
C:\Qt\5.15.2\msvc2015_64\include\QtCore/qvector.h(410): warning C4003: not enough actual parameters for macro 'realloc'
C:\Qt\5.15.2\msvc2015_64\include\QtCore/qvector.h(419): warning C4003: not enough actual parameters for macro 'realloc'
C:\Qt\5.15.2\msvc2015_64\include\QtCore/qvector.h(699): warning C4346: 'QVector<T>::PMemoryHeap::Reallocate': dependent name is not a type
C:\Qt\5.15.2\msvc2015_64\include\QtCore/qvector.h(699): note: prefix with 'typename' to indicate a type
C:\Qt\5.15.2\msvc2015_64\include\QtCore/qvector.h(699): error C2988: unrecognizable template declaration/definition
C:\Qt\5.15.2\msvc2015_64\include\QtCore/qvector.h(699): error C2059: syntax error: 'string'
C:\Qt\5.15.2\msvc2015_64\include\QtCore/qvector.h(766): error C2063: 'Reallocate': not a function
C:\Qt\5.15.2\msvc2015_64\include\QtCore/qvector.h(766): fatal error C1903: unable to recover from previous error(s); stopping compilationAs we tried to resolve the error, we found that whenever we are adding "#include <QObject>" in only one file name as "Manager.h" it start giving above mentioned error. As we remove "#include <QObject>" header and all other signal and slot(Q_SIGNAL Q_INVOKABLE) from "Manager.h" error goes.
Note: Whatever error mentioned is only occured while building project in Debug mode in windows.QT Creator : 5.0.2 Based on Qt 5.15.2 (MSVC 2019, 64 bit)
O.S. Windows 10 Home x64 -
Hi.
I am working on one project where we am using third party library ptlib and opal.
We have ptlib and opal library working for both linux and windows. Our project is working fine in both Debug and Release build in Ubuntu 20.04 OS and same project is working with Windows Release build.
But whenever we are trying to build same code is Debug mode in Windows it is giving below,C:\Qt\5.15.2\msvc2015_64\include\QtCore/qvector.h(103): warning C4003: not enough actual parameters for macro 'realloc'
C:\Qt\5.15.2\msvc2015_64\include\QtCore/qvector.h(316): error C2059: syntax error: 'string'
C:\Qt\5.15.2\msvc2015_64\include\QtCore/qvector.h(327): note: see reference to class template instantiation 'QVector<T>' being compiled
C:\Qt\5.15.2\msvc2015_64\include\QtCore/qvector.h(316): error C3254: 'QVector<T>': class contains explicit override 'Reallocate' but does not derive from an interface that contains the function declaration
C:\Qt\5.15.2\msvc2015_64\include\QtCore/qvector.h(316): error C2838: 'Reallocate': illegal qualified name in member declaration
C:\Qt\5.15.2\msvc2015_64\include\QtCore/qvector.h(410): warning C4003: not enough actual parameters for macro 'realloc'
C:\Qt\5.15.2\msvc2015_64\include\QtCore/qvector.h(419): warning C4003: not enough actual parameters for macro 'realloc'
C:\Qt\5.15.2\msvc2015_64\include\QtCore/qvector.h(699): warning C4346: 'QVector<T>::PMemoryHeap::Reallocate': dependent name is not a type
C:\Qt\5.15.2\msvc2015_64\include\QtCore/qvector.h(699): note: prefix with 'typename' to indicate a type
C:\Qt\5.15.2\msvc2015_64\include\QtCore/qvector.h(699): error C2988: unrecognizable template declaration/definition
C:\Qt\5.15.2\msvc2015_64\include\QtCore/qvector.h(699): error C2059: syntax error: 'string'
C:\Qt\5.15.2\msvc2015_64\include\QtCore/qvector.h(766): error C2063: 'Reallocate': not a function
C:\Qt\5.15.2\msvc2015_64\include\QtCore/qvector.h(766): fatal error C1903: unable to recover from previous error(s); stopping compilationAs we tried to resolve the error, we found that whenever we are adding "#include <QObject>" in only one file name as "Manager.h" it start giving above mentioned error. As we remove "#include <QObject>" header and all other signal and slot(Q_SIGNAL Q_INVOKABLE) from "Manager.h" error goes.
Note: Whatever error mentioned is only occured while building project in Debug mode in windows.QT Creator : 5.0.2 Based on Qt 5.15.2 (MSVC 2019, 64 bit)
O.S. Windows 10 Home x64Nothing to do with Qt: https://titanwolf.org/Network/Articles/Article?AID=d89ed3ee-1cc3-4a32-b28c-a88d2176e11f
-
Nothing to do with Qt: https://titanwolf.org/Network/Articles/Article?AID=d89ed3ee-1cc3-4a32-b28c-a88d2176e11f