Compiling error: 2574: explicit specialization of <entity> must precede its first use (<entity>)

2.4k views Asked by At

When using the armcc4.1 to compiler my code, it reports following error:

"access/qnetworkrequest_p.h", line 94: Error: #2574: explicit specialization of class "QTypeInfo>" must precede its first use (at line 105 of "../../include/QtCore/../../src/corelib/tools/qlist.h") Q_DECLARE_TYPEINFO(QNetworkHeadersPrivate::RawHeaderPair, Q_MOVABLE_TYPE);

class QNetworkHeadersPrivate
{
public:
    typedef QPair<QByteArray, QByteArray> RawHeaderPair;
    typedef QList<RawHeaderPair> RawHeadersList;
...
};

Q_DECLARE_TYPEINFO(QNetworkHeadersPrivate::RawHeaderPair, Q_MOVABLE_TYPE);

But, is there a way to disable or bypass this error?

3

There are 3 answers

0
thincal On BEST ANSWER

Answer my question: finally it's fixed by removing the last line, it's because this declaration is redundant.

0
jxh On

I would try to modify the inclusion order of the header files.

0
Johannes Schaub - litb On

Dont do list operations before not having the element type declared movable. Define any member function body that does so after the macro.