Enum class sample
-
Hi!
I would like to use an enum class, this is in an included header:
class Ble: public QObject { Q_OBJECT public: enum Message { hubproperty = 0x01, hubattachedio = 0x04, hwnetworkcommand = 0x08, portinputformat = 0x41, portvalue = 0x45 }; Q_ENUM(Message) };
The compiler give this error:
undefined reference to `Ble::staticMetaObject'
Thanks in advance
-
Hi!
I would like to use an enum class, this is in an included header:
class Ble: public QObject { Q_OBJECT public: enum Message { hubproperty = 0x01, hubattachedio = 0x04, hwnetworkcommand = 0x08, portinputformat = 0x41, portvalue = 0x45 }; Q_ENUM(Message) };
The compiler give this error:
undefined reference to `Ble::staticMetaObject'
Thanks in advance
-
Hi!
I would like to use an enum class, this is in an included header:
class Ble: public QObject { Q_OBJECT public: enum Message { hubproperty = 0x01, hubattachedio = 0x04, hwnetworkcommand = 0x08, portinputformat = 0x41, portvalue = 0x45 }; Q_ENUM(Message) };
The compiler give this error:
undefined reference to `Ble::staticMetaObject'
Thanks in advance
-
@J-Hilk This error is produced by linker, in the object file, where is this line:
QMetaEnum::fromType<Ble::Message>().valueToKey(m)
m is a message code integer.
@Kutyus
https://github.com/DeiVadder/Topic109331working class
-
@Kutyus said in Enum class sample:
QMetaEnum::fromTypeBle::Message().valueToKey(m)
When I comment out the line wich contains the QMetaEnum::fromTypeBle::Message().valueToKey(m), the code is compiled succes.
How can i get the enum name from its value?