Important: Please read the Qt Code of Conduct -

Reusing a cmake-built QT project in Visual Studio 2015: “connectSlotsByName: No matching signal”

  • As mentioned above my task is to change the code of an existing visual studio project that uses QT 5.7. The student who has worked on it before me built his project with cmake with which I am completely unfamiliar, while absolutely having no time to get into, unfortunately.

    My first attempt is to set up a new VS-project into which I paste all source files and QT-files necessary. This has resulted in several problems, one of which was that I had to delete, save and rewrite "Q_OBJECT" in all Q-Classes. This tells me that the actual workflow is compromising the project right from the beginning.

    With regards to this, my predecessor used QMetaObject::connectSlotsByName to connect signals and slots of Gui-Objects like Buttons. When debugging I get

    "QMetaObject::connectSlotsByName: No matching signal for on_[some Gui Obejct]_clicked()"

    for all of the existing QWidget-Childs in the GUI.

    This seems strange, because the signals of such buttons and so on, have to exist in moc-code (the corresponding slots exist of course), correct?

    There are a decent amount of Gui-elements existing in the project, so I prefer to not use connect for every single one of them.


    1.) Is there a recommended workflow, that will enable one to shoot oneself in the foot less often? 2.) In order to enable Qt's Meta-Object-Compiler to create ui_.h's and moc_.cpp's it needs .ui's, .qrc's, and potential resource files, correct?
    3.) To what extent is it possible that the fact that the project was originally built with cmake affects Qt-meta compiling?

    Thank you very much in advance

  • Lifetime Qt Champion

    Hi and welcome to devnet,

    The quicker would have likely been to install cmake and use Qt Creator which handles that out of the box.

    You’ll loose less time than trying to redo everything by hand.

    Another solution is to create a qmake project. You can do that using the -project option of qmake inside the sources of your application. From there you can generate a VS solution and build it.

  • Thank you very much for your answer.

    would you mind listing more detailed steps to try your recommended solutions?
    That would make it possible for me to choose witrh regards to whether or not I have the necessary knowledge. Thank you.

  • In the meantime, I achieved to produce the following vs15-errors in Qt Creator while trying to build after running cmake on the top cmakefile.txt.

    NMAKE:-1: error: U1077: "echo": return code "0xa"
    file not found: NMAKE

    NMAKE:-1: error: U1077: ""C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\amd64\nmake.exe"": Rückgabe-Code "0x2"
    file not found: NMAKE

    NMAKE:-1: error: U1077: ""C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\amd64\nmake.exe"": Rückgabe-Code "0x2"
    file not found: NMAKE

    nmake.exe is located at exactly that location.

  • This list ended up being longer than I thought but each is simple and all but the last only need to be done once.

    • Install CMake (
    • Configure QtCreator go to Tools->Options->Kits
    • Go to the CMake tab and add the location of cmake.exe if not automatically found
    • Apply those changes and go to the 'Kits' tab
    • For the kit you are using, make sure the 'CMake-Tool' is set.
    • Save/close tools window
    • Go to 'Open File or Project' and select the CMakeLists.txt file of the project.

    After this, building and running is not very different from a .pro-defined project.

  • @mchinand
    Thank you for your patience.

    I have done exactly that which results in the errors that are listed above.

    Furthermore, I have found out that the cmakefiles also take into account Tortoise SVN. I wonder if not using the latter could create some obstacles.

  • If you have previously been using Visual Studio, first make sure Qt Creator is set up correctly. Try building and running a Qt example.

Log in to reply