Solved Weird signal and slot problem
-
hello, I'm trying to conect a signal from an object, to a signal on a thread, both QString. I make the conection on main window, that is my code (in mainwindow):
gMsg = new getmsg(this,mWSize.x,mWSize.y); serPort = new sport(this); serPort->start(); connect(gMsg,SIGNAL(rqstAll(QString)),serPort,SLOT(updateMsg(QString)),Qt::QueuedConnection);
the compiler get the next error that i could not solved, deleting the temporary compile directory and right botton on project + clean
I ask you please help on Monday, the boss will give me the talk of dismissal (), but I want the program end.
Thanks in advance
moc_sport.obj:-1: error: LNK2019: unresolved external symbol "public: void __cdecl sport::updateMsg(class QString)" (?updateMsg@sport@@QEAAXVQString@@@Z) referenced in function "private: static void __cdecl sport::qt_static_metacall(class QObject *,enum QMetaObject::Call,int,void * *)" (?qt_static_metacall@sport@@CAXPEAVQObject@@W4Call@QMetaObject@@HPEAPEAX@Z)
-
I'm not 100% which one of these causes the error but:
- Make sure that your
sport
class has theQ_OBJECT
macro - If you added the
Q_OBJECT
macro after the first compile, you must manually re-runqmake
by Build -> Run qmake - Make sure that your
sport
class actually has theupdateMsg()
method implemented - Make sure that your
sport
class actually lists theupdateMsg()
method in thepublic slots
section
I hope that helps.
- Make sure that your
-
Thank you very much for your help.
Finally was that i forget sport:: on
void sport::updateMsg(QString newMsg){
}