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

StackOverflow https://stackoverflow.com/questions/10909046

  •  12-06-2021
  •  | 
  •  

Question

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?

Was it helpful?

Solution

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

OTHER TIPS

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

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top