This question already has an answer here:<ul><li> <a href="/questions/24355023/qmetaobjectconnectslotsbyname-no-matching-signal" dir="ltr" rel="nofollow">QMetaObject::connectSlotsByName: No matching signal</a> <span class="question-originals-answer-count"> 2 answers </span> </li> </ul>
I realise this question has been asked before, though my circumstances are slightly different and I have found none of the other answers helpful, I am new to QTCreator.
I am trying to build a project with QTCreator, that builds fine on OSX but when building it with Ubuntu I get this error:
QMetaObject::connectSlotsByName: No matching signal for on_actionWrite_Device_triggered()
The project still builds and partly works, but will not write to an external device (the point of the program).
Can anyone give a walkthrough of what I need to do, previous answers have said about explicitly connecting things, but not gone into details about how to do this. Any tips on searching through the project to find where to make this fix (I didn't write the original program).
Any help is appreciated TomAnswer1:
Check out this: <a href="http://qt-project.org/doc/qt-4.8/qmetaobject.html#connectSlotsByName" rel="nofollow">http://qt-project.org/doc/qt-4.8/qmetaobject.html#connectSlotsByName</a>
The Method connectSlotsByName tries to connect slots to signals using the following form:
void on_<object name>_<signal name>(<signal parameters>);
Object name and signal name are separated by an underscore. I'm not sure but it may be a problem that the object name itself (actionWrite_Device) contains an underscore and therefore it is not clear what the signal name is (it could be either
triggered). The same holds for the object name. This ambiguity might cause the trouble.
If this work son one platform, but does not on another, then a possible reason is, you don't have a clean build on one of the platforms.
To have clean build, first of all clean all extra files from source directory (for example using version control tools to remove all unversioned files). This is important, because compiler will look for some files preferntially under source directory, and if there are stale generated source files (
ui_*.h, etc) there, they will be used instead of the right ones in build directory. Then make sure you have shadow builds enabled in Qt Creator for the project and the build, and do a clean build.
Or just get a fresh checkout/clone from version control to a clean directory.<hr />
Another possible reason is use of
#ifdef resulting in different build result on different platforms. Or the project's
.pro file may also have conditional sections, resulting in different files being built on different platforms, or different compile commands being used.