Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [SOLVED] No matching function call ... but function is not called in my code
Forum Update on Monday, May 27th 2025

[SOLVED] No matching function call ... but function is not called in my code

Scheduled Pinned Locked Moved General and Desktop
6 Posts 2 Posters 3.1k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    BDifferent
    wrote on 4 Nov 2013, 11:15 last edited by
    #1

    Hi all,
    I have a problem in my code - and it is either something I am overlooking after having looked at it a 1000 times, or ... something different :-)

    The error message is:
    @..\project\mainwindow.cpp: In constructor 'MainWindow::MainWindow(QWidget*)':
    ..\project\mainwindow.cpp:16:26: error: no matching function for call to 'TimeSeries::TimeSeries()'
    ui(new Ui::MainWindow)@

    So that is a very basic error message that everyone knows - the thing is that I do not call this constructor at all in the code section in question. The constructor to my TimeSeries class had no parameter before and I added a QString afterwards, which is when the error message showed up.
    If course I have searched all project code for calls to the constructor and checked that they all have the parameter passed.
    The fact that the error occurs in the MainWindow constructor led me to the idea that it might be something Qt-specific (moc et al.), however cleaning and rebuilding, as well as deleting and re-adding a signal&slot did not help (there is a function connected to a button that is called DrawTimeSeries()",i.e. a part of its name is the same as the class constructor - I even renamed that one, you never know :-) ).

    Is there something very obvious that I am overlooking?

    1 Reply Last reply
    0
    • J Offline
      J Offline
      Jeroentjehome
      wrote on 4 Nov 2013, 11:33 last edited by
      #2

      Hmm,
      The ui(new Ui::MainWindow) is created by converting a QtDesigner form to code. There should also be a ui_Mainwindow.h file in your build directory. So somehow you messed up your MainWindow and the MainWindow QtDesigner class. The compiler is unable to find the ui_MainWindow.h file where the constructor of your form class is.
      Greetz

      Greetz, Jeroen

      1 Reply Last reply
      0
      • B Offline
        B Offline
        BDifferent
        wrote on 4 Nov 2013, 11:55 last edited by
        #3

        I suspected something like that - but what is the solution? As I wrote, I already cleaned and rebuilt - and I also deleted my build directory, i.e. the file has been recreated. If I remove the parameter from the constructor again the code compiles without a problem. So the MainWindow and the QTDesigner classes shoud be okay.

        1 Reply Last reply
        0
        • J Offline
          J Offline
          Jeroentjehome
          wrote on 4 Nov 2013, 12:42 last edited by
          #4

          Did you remove the
          @
          namespace Ui {
          class MainWindow;
          }
          @
          Above your MainWindow class declaration (header file) and check that in the ui_Mainwindow.h this is at the end of the file:
          @
          namespace Ui {
          class MainWindow: public Ui_MainWindow {};
          } // namespace Ui
          @
          Then you should be done. The last part in the ui_Mainwindow is the definition and declaration of your constructor ui_Mainwindow class.

          Without the namespace the Ui identifier doesn't tell the compiler where to find the declarations.

          Greetz, Jeroen

          1 Reply Last reply
          0
          • B Offline
            B Offline
            BDifferent
            wrote on 4 Nov 2013, 13:59 last edited by
            #5

            Dear Jeroen,
            thanks, yes, the code looks exactly like that, so it seems to be not corrupted.

            I have removed the parameter from the constructor and now it works again, so I can proceed with development for the time being, however, this is only a workaround since I need that parameter there :-)

            1 Reply Last reply
            0
            • B Offline
              B Offline
              BDifferent
              wrote on 4 Nov 2013, 14:17 last edited by
              #6

              Ok, problem solved :-)

              In fact the constructor was nowhere called explicitly in the code without parameters; however, I had an instance of this class as a member of the MainWindow class - and not as a pointer to a TimeSeries object, so of course this instance is created on the stack upon creation of the MainWindow object, and here no parameters were given indeed.

              Thanks for your efforts, Jeroen!

              1 Reply Last reply
              0

              1/6

              4 Nov 2013, 11:15

              • Login

              • Login or register to search.
              1 out of 6
              • First post
                1/6
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved