Hello!
I've just played with qjson library and got "underfinded reference" error. This is a code:
#include <qjson/qobjecthelper.h>
#include <qjson/serializer.h>
class Person: public QObject {
Q_OBJECT
Q_PROPERTY(QString name READ name WRITE setName)
Q_PROPERTY(Gender gender READ gender WRITE setGender)
Q_ENUMS(Gender)
public:
Person(QObject *parent = 0);
~Person();
QString name() const;
void setName(const QString &name);
enum Gender{Male, Female};
Gender gender() const;
void setGender(Gender gender);
private:
QString m_name;
Gender m_gender;
};
int main ()
{
Person person;
QJson::Serializer serializer;
person.setName("Nick");
person.setGender(Person::Male);
QVariantMap person_map = QJson::QObjectHelper::qobject2qvariant(&person);
QByteArray json = serializer.serialize(person_map);
return 0;
}
So, compilier says that it's "undefined reference to Person::Person" and all other functions in Person class. Why?
P.S. I'm newbie in c++ :)