Good day,
I have the first time this kind of error.
// another.h
struct Item {
QString name = QString();
QString description = QString();
QVariant value = QVariant();
struct Interface {
uint id = 0;
uint pos = 0;
} mkio, uks;
struct Element {
float weight = 0;
struct Range {
uint from = 0;
uint to = 0;
} range;
int index = 0;
} element;
};
I would like to store this nested struct in a stream. So,
// another.h
QDataStream &operator<<(QDataStream &out, const Item::Interface &interface)
{
return out << interface.id
<< interface.pos;
}
// and another overload operator>> and operator<<...
// Another fields of the `Item` struct are compiling without any error.
1) error: expected ',' or '...' before 'struct' QDataStream &operator<<(QDataStream &out, const Item::Interface &interface)
2) another.h:34:17: error: expected primary-expression before 'struct'
return out << interface.id
^
another.h:34:17: error: expected ';' before 'struct'
another.h:34:17: error: expected primary-expression before 'struct'
Aucun commentaire:
Enregistrer un commentaire