I have a simple Customer class with 3 static QMap
//customer.h
class Customer : public QObject
{
Q_OBJECT
public:
static QMap<Customer::Type, QString> const names;
static QMap<QString, Customer::Type> const keywords;
static QMap<Customer::Type, QString> const debugStrings;
};
Customer::Type is a Enum, but this is not relevant to the problem
//customer.cpp
//QMap<QString, Customer::Type> const Customer::names = Customer::initNames();
QMap<QString, Customer::Type> const Customer::keywords = Customer::initKeywords();
QMap<Customer::Type, QString> const Customer::debugStrings = Customer::initDebugStrings();
all three init function have been tested and work perfectly fine, they are defined exactly the same way and are all static
For some reason, I cannot uncomment the names in .cpp. If I do, I get the following error :
error: conflicting declaration 'const QMap<QString, Customer::Type> Customer::names'
I tried renaming, moving it somewhere else, it always is this one that doesn't work, and I don't know why ?
But the other ones worked with no issue..