Results 1 to 19 of 19

Thread: ambiguous call to overloaded function

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Feb 2006
    Posts
    51
    Thanks
    7

    Default ambiguous call to overloaded function

    hello there,

    I am getting a kind of weired compiling error which says:

    Qt Code:
    1. error C2668: 'testingQtMainWindow::testingQtMainWindow' : ambiguous call to overloaded function
    2. Error executing cl.exe.
    To copy to clipboard, switch view to plain text mode 

    this is a simple test programme to make a main window with menu's. and the error is occuring in the main.cpp section of the programme. any idea's what i am doing wrong???
    Love::Peace

  2. #2
    Join Date
    Jan 2006
    Location
    Saint-Petersburg (Russia)
    Posts
    41
    Thanks
    1
    Thanked 2 Times in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: ambiguous call to overloaded function

    SOurce please...
    Succes is 5% of talent and 95% of work!

  3. #3
    Join Date
    Feb 2006
    Posts
    51
    Thanks
    7

    Default Re: ambiguous call to overloaded function

    this is the source and the error is occuring on line "5":

    Qt Code:
    1. int main( int argc, char** argv )
    2. {
    3. QApplication app( argc, argv );
    4.  
    5. testWindow *tw = new testWindow();
    6. tw->setCaption("test");
    7. app.setMainWidget( tw );
    8. tw->show();
    9.  
    10. app.connect(&app, SIGNAL(lastWindowClosed()),&app, SLOT(quit() ));
    11. return app.exec();
    12. }
    To copy to clipboard, switch view to plain text mode 
    Last edited by :db:sStrong; 9th February 2006 at 13:09.
    Love::Peace

  4. #4
    Join Date
    Jan 2006
    Location
    Ukraine,Lviv
    Posts
    454
    Thanks
    9
    Thanked 27 Times in 27 Posts
    Qt products
    Qt3
    Platforms
    Unix/X11 Windows

    Default Re: ambiguous call to overloaded function

    There is not enough code! Show header and implementation of your testWindow class.
    a life without programming is like an empty bottle

  5. #5
    Join Date
    Feb 2006
    Posts
    51
    Thanks
    7

    Default Re: ambiguous call to overloaded function

    this is my header file:

    Qt Code:
    1. #include <qmainwindow.h>
    2.  
    3. class QWorkspace;
    4. class QTextEdit;
    5.  
    6. class testWindow : public QMainWindow
    7. {
    8. Q_OBJECT
    9.  
    10. public:
    11. testWindow( QWidget* parent = 0, const char* name = 0, WFlags f = WType_TopLevel );
    12. testWindow();
    13. ~testWindow();
    14.  
    15. protected:
    16. QWorkspace *mdi;
    17.  
    18. protected slots:
    19.  
    20. void something();
    21.  
    22. private slots:
    23.  
    24.  
    25. private:
    26.  
    27. };
    To copy to clipboard, switch view to plain text mode 

    and this is my implementation file:

    Qt Code:
    1. #include "testwindow.h"
    2.  
    3. // here are othe qt header files.
    4.  
    5. testWindow::testWindow( QWidget* parent, const char* name, WFlags f )
    6. : QMainWindow( parent, name, f )
    7. {
    8.  
    9. //here comes my code
    10. }
    To copy to clipboard, switch view to plain text mode 
    Love::Peace

  6. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: ambiguous call to overloaded function

    Quote Originally Posted by :db:sStrong
    testWindow( QWidget* parent = 0, const char* name = 0, WFlags f = WType_TopLevel );
    testWindow();
    Both of these constructors can be invoked without parameters and compiler doesn't know which one to choose. Do you need that second constructor?

  7. #7
    Cesar Guest

    Default Re: ambiguous call to overloaded function

    Quote Originally Posted by :db:sStrong
    this is my header file:
    Qt Code:
    1. #include <qmainwindow.h>
    2.  
    3. class QWorkspace;
    4. class QTextEdit;
    5.  
    6. class testWindow : public QMainWindow
    7. {
    8. Q_OBJECT
    9.  
    10. public:
    11. testWindow( QWidget* parent = 0, const char* name = 0, WFlags f = WType_TopLevel );
    12. testWindow();
    13. ~testWindow();
    14. //skip
    15. };
    To copy to clipboard, switch view to plain text mode 
    Let's see...
    Qt Code:
    1. testWindow *tw = new testWindow();
    To copy to clipboard, switch view to plain text mode 
    could be interpreted as both
    Qt Code:
    1. testWindow *tw = new testWindow::testWindow();
    To copy to clipboard, switch view to plain text mode 
    and
    Qt Code:
    1. testWindow *tw = new testWindow::testWindow(0, 0, WType_TopLevel);
    To copy to clipboard, switch view to plain text mode 
    That's why you get ambiguous call to overloaded function error.

  8. #8
    Join Date
    Jan 2006
    Location
    Saint-Petersburg (Russia)
    Posts
    41
    Thanks
    1
    Thanked 2 Times in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: ambiguous call to overloaded function

    Quote Originally Posted by :db:sStrong
    this is the source and the error is occuring on line "5":

    Qt Code:
    1. int main( int argc, char** argv )
    2. {
    3. QApplication app( argc, argv );
    4.  
    5. testWindow *tw = new testWindow();
    6. tw->setCaption("test");
    7. app.setMainWidget( tw );
    8. tw->show();
    9.  
    10. app.connect(&app, SIGNAL(lastWindowClosed()),&app, SLOT(quit() ));
    11. return app.exec();
    12. }
    To copy to clipboard, switch view to plain text mode 
    testWindow - show include header of this class please
    Succes is 5% of talent and 95% of work!

  9. #9
    Join Date
    Feb 2006
    Posts
    51
    Thanks
    7

    Default Re: ambiguous call to overloaded function

    Quote Originally Posted by blackliteon
    testWindow - show include header of this class please
    include header of this class is:

    Qt Code:
    1. #include <qapplication.h>
    2. #include "testwindow.h"
    To copy to clipboard, switch view to plain text mode 
    Love::Peace

  10. #10
    Join Date
    Jan 2006
    Location
    Ukraine,Lviv
    Posts
    454
    Thanks
    9
    Thanked 27 Times in 27 Posts
    Qt products
    Qt3
    Platforms
    Unix/X11 Windows

    Default Re: ambiguous call to overloaded function


    you have decalre 2 empty constructor!

    p.s. too slow
    p.p.s. useless thread
    Last edited by zlatko; 9th February 2006 at 13:44.
    a life without programming is like an empty bottle

  11. #11
    Join Date
    Feb 2006
    Posts
    51
    Thanks
    7

    Default Re: ambiguous call to overloaded function

    Quote Originally Posted by zlatko

    you have decalre 2 empty constructor!
    yes i saw it haha
    Love::Peace

  12. #12
    Join Date
    Feb 2006
    Posts
    51
    Thanks
    7

    Default Re: ambiguous call to overloaded function

    Quote Originally Posted by zlatko

    you have decalre 2 empty constructor!

    p.s. too slow
    p.p.s. useless thread
    a thread can never be useless sometimes u cant see the prob and small probs sometimes take much time

    ESPASEBE(thanx in russian)
    Love::Peace

  13. #13
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,018 Times in 4,794 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: ambiguous call to overloaded function

    Quote Originally Posted by :db:sStrong
    ESPASEBE(thanx in russian)
    Не за что

  14. #14
    Join Date
    Feb 2006
    Posts
    51
    Thanks
    7

    Default Re: ambiguous call to overloaded function

    Quote Originally Posted by wysota
    Не за что
    may i know what does it mean?

    i can speak a little rusian but i cant read
    Love::Peace

  15. #15
    Join Date
    Jan 2006
    Location
    Ukraine,Lviv
    Posts
    454
    Thanks
    9
    Thanked 27 Times in 27 Posts
    Qt products
    Qt3
    Platforms
    Unix/X11 Windows

    Default Re: ambiguous call to overloaded function

    Quote Originally Posted by :db:sStrong
    may i know what does it mean?

    i can speak a little rusian but i cant read
    not at all)

    p.s. in ukraine language it sound better
    a life without programming is like an empty bottle

  16. #16
    Join Date
    Feb 2006
    Posts
    51
    Thanks
    7

    Default Re: ambiguous call to overloaded function

    Quote Originally Posted by zlatko
    not at all)

    p.s. in ukraine language it sound better
    i have been to ukraine, the language is totally different from russian Kiev is the best place to be
    Love::Peace

  17. #17
    Cesar Guest

    Default Re: ambiguous call to overloaded function

    Quote Originally Posted by wysota
    Не за что
    means You're welcome!
    Guys, I suppose we should avoid using Russian and stop confusing others

  18. #18
    Join Date
    Feb 2006
    Posts
    51
    Thanks
    7

    Default Re: ambiguous call to overloaded function

    oeps i found it

    i got this warning:

    Qt Code:
    1. multiple default constructors specified
    To copy to clipboard, switch view to plain text mode 

    and i have removed these lines:

    Qt Code:
    1. testingWindow();
    2. ~testingWindow();
    To copy to clipboard, switch view to plain text mode 

    it works now fine..

    thanx anyways guys

    bye
    Love::Peace

  19. #19
    Join Date
    Jan 2006
    Location
    Athens - Greece
    Posts
    219
    Thanks
    3
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: ambiguous call to overloaded function

    Quote Originally Posted by :db:sStrong
    ...and i have removed these lines:
    Qt Code:
    1. testingWindow();
    2. ~testingWindow();
    To copy to clipboard, switch view to plain text mode 
    ...
    Don't remove the destructor, the poor thing never caused you any harm

Similar Threads

  1. QPSQL problem
    By LoneWolf in forum Installation and Deployment
    Replies: 60
    Last Post: 4th November 2009, 14:22
  2. Regading Driver to connect Postgresql Database
    By dummystories in forum Installation and Deployment
    Replies: 38
    Last Post: 12th March 2009, 07:19
  3. QPSQL driver in windows
    By brevleq in forum Installation and Deployment
    Replies: 31
    Last Post: 14th December 2007, 12:57
  4. how to add static library into qmake
    By Namrata in forum Qt Tools
    Replies: 1
    Last Post: 20th November 2007, 17:33
  5. use qpsql
    By raphaelf in forum Installation and Deployment
    Replies: 34
    Last Post: 22nd August 2006, 12:52

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.