Создал небольшой текст со своим классом
-------------quit.h-----------
#ifndef QUIT_H #define QUIT_H
#include <qdialog.h>
class MyClass : public QObject { Q_OBJECT public: int b;
signals: void mysignal();
private slots: void myslot(); };
#endif
---------quit.cpp-----------
#include "quit.h"
void MyClass::mysignal() { b=5; }
void MyClass::myslot() {
emit mysignal(); }
-----------main.cpp------------
#include <qapplication.h> #include <qpushbutton.h>
#include "quit.h"
int main(int argc, char *argv[]) { QApplication app(argc, argv); QPushButton *button = new QPushButton("Quit", 0); MyClass myclass2; QObject::connect(button, SIGNAL(clicked()), &app, SLOT(quit())); // QObject::connect(&myclass2, SIGNAL(mysignal123()), // &app, SLOT(quit())); app.setMainWidget(button); button->show(); return app.exec(); }
И вот что-то не собирается говорит что multiple definition of 'MyClass::mysignal()' quit.o : firts defined here
Где грабли то ?