I have a problem including Qt libraries to one of my projects. The includes are:
#include <QtCore/QString>
#include <QtXml/QDomDocument>
#include <iostream>
#pragma push_macro("realloc")
#undef realloc
#include <QtCore/QFile>
#include <QtCore/QFileInfo>
#include <QtCore/QDir>
#pragma pop_macro("realloc")
Includes QFile
, QFileInfo
and QDir
cause this error:
C:\qt\5.15.0\msvc2019_64\include\QtCore\qlist.h(466): error C2061: syntax error: identifier 'n'
C:\qt\5.15.0\msvc2019_64\include\QtCore\qlist.h(464): note: while compiling class template member function 'void QList<QString>::node_construct(QList<QString>::Node *,const T &)'
with
[
T=QString
]
C:\qt\5.15.0\msvc2019_64\include\QtCore\qlist.h(625): note: see reference to function template instantiation 'void QList<QString>::node_construct(QList<QString>::Node *,const T &)' being compiled
with
[
T=QString
]
C:\qt\5.15.0\msvc2019_64\include\QtCore\qlist.h(854): note: while compiling class template member function 'QList<QString>::QList(const QList<QString> &)'
C:\qt\5.15.0\msvc2019_64\include\QtCore\qstringlist.h(117): note: see reference to function template instantiation 'QList<QString>::QList(const QList<QString> &)' being compiled
C:\qt\5.15.0\msvc2019_64\include\QtCore\qstringlist.h(112): note: see reference to class template instantiation 'QList<QString>' being compiled
C:\qt\5.15.0\msvc2019_64\include\QtCore\qlist.h(505): error C2061: syntax error: identifier 'current'
C:\qt\5.15.0\msvc2019_64\include\QtCore\qlist.h(487): note: while compiling class template member function 'void QList<QString>::node_copy(QList<QString>::Node *,QList<QString>::Node *,QList<QString>::Node *)'
C:\qt\5.15.0\msvc2019_64\include\QtCore\qlist.h(860): note: see reference to function template instantiation 'void QList<QString>::node_copy(QList<QString>::Node *,QList<QString>::Node *,QList<QString>::Node *)' being compiled
The push/pop macro is used because of similar error with realloc template, which was resolved here: Qt: not enough arguments for function-like macro invocation 'realloc', qvector.h.