Qt: not enough arguments for function-like macro invocation 'realloc', qvector.h

1k Views Asked by At

I have a problem, including some QtCore libraries in my project. I am using CMake and Visual Studio Qt 5.15. In my CMakeLists.txt I include QtCore like this:

find_package(Qt5 REQUIRED COMPONENTS Core)

target_link_libraries(${projectName} PRIVATE Qt5::Core)

Then I add #include <QtCore/qvector.h> in my code and some errors will show up:

C:\qt\5.15.0\msvc2019_64\include\QtCore\qvector.h(103): warning C4003: not enough arguments for function-like macro invocation 'realloc'
C:\qt\5.15.0\msvc2019_64\include\QtCore\qvector.h(316): error C2059: syntax error: 'constant'
C:\qt\5.15.0\msvc2019_64\include\QtCore\qvector.h(327): note: see reference to class template instantiation 'QVector<T>' being compiled
C:\qt\5.15.0\msvc2019_64\include\QtCore\qvector.h(411): warning C4003: not enough arguments for function-like macro invocation 'realloc'
C:\qt\5.15.0\msvc2019_64\include\QtCore\qvector.h(420): warning C4003: not enough arguments for function-like macro invocation 'realloc'
C:\qt\5.15.0\msvc2019_64\include\QtCore\qvector.h(700): error C2988: unrecognizable template declaration/definition
C:\qt\5.15.0\msvc2019_64\include\QtCore\qvector.h(700): error C2059: syntax error: 'constant'
C:\qt\5.15.0\msvc2019_64\include\QtCore\qvector.h(1071): warning C4003: not enough arguments for function-like macro invocation 'realloc'

This errors will appear even if I include only <QtCore/QFileInfo> or <QtCore/QDir>. But When I include <QtCore/QString> or <QtXml/QDomDocument> this errors won't show up.

I tried deleting CMake cache, but with no result. This problem has started since migrating from Visual Studio solution to CMake.

0

There are 0 best solutions below