I am new in c++ programming and also in QT.
I want to test Qt slots and signals and see how they work. I have a header file named myclass.h which has following code:
#ifndef MYCLASS_H
#define MYCLASS_H
#include <QObject>
#include <QString>
class myclass: public QObject
{
   Q_OBJECT
   public:
     myclass(const QString &text, QObject *parent=0);
     const QString& text() const;
     int getlengthoftext() const;
   public slots:
     void settext(const QString &text);
   signals:
     void changedtext(const QString&);
     private:
     QString m_text;
};
and a file with class_mine name with the following code :
#include "myclass.h"
#include <QObject>
#include <QString>
void myclass::settext(const QString &text)
{
     if (m_text==text)
        return;
     m_text =text;
     emit changedtext(m_text);
} 
#endif
and in my main file I have this :
#include "mainwindow.h"
#include <QApplication>
#include "myclass.h"
int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    // MainWindow w;
    // w.show();
    QObject parent;
    myclass *a1 , *b , *c;
    a1=new myclass("foo" , &parent);
    b=new myclass("bar" , &parent);
    c=new myclass("baz" , &parent);
    QObject::connect(a1,SIGNAL(changedtext(const QString&)),
    b,SLOT(settext(const QString&)));
    QObject::connect(b,SIGNAL(changedtext(const QString&)),
    c,SLOT(settext(const QString&)));
    QObject::connect(c,SIGNAL(changedtext(const QString&)),
    b,SLOT(settext(const QString&)));
    b->settext("text");
    return a.exec();
}
I don't know why I'm getting this error:
main.cpp:13: error: undefined reference to `myclass::myclass(QString const&, QObject*)'
 
    