Results 1 to 4 of 4

Thread: Compilation Error: base class undefined in the class created from UI file

  1. #1
    Join Date
    Dec 2008
    Posts
    68

    Default Compilation Error: base class undefined in the class created from UI file

    Hi,

    I am porting my Qt3.3 program to Qt4.4.3. I used qt3to4 program to compile my .pro file and run qmake to created a vc++ project.

    One of the form (UI files in .PRO file) is compile and created a class, Ui::MainWindow.

    Based on this, a new class is defined as in mainwindow.h file.

    Qt Code:
    1. class MainWindow : public Q3MainWindow, public Ui::MainWindow
    2. {
    3. Q_OBJECT
    4.  
    5. public:
    6. MainWindow(QWidget* parent = 0, const char* name = 0, Qt::WindowFlags fl = Qt::WType_TopLevel);
    7. ~MainWindow();
    8.  
    9. protected slots:
    10. virtual void languageChange();
    11.  
    12. };
    To copy to clipboard, switch view to plain text mode 
    In mainwindow.cpp file, it has:

    Qt Code:
    1. #include ...
    2.  
    3. MainWindow::MainWindow(QWidget* parent, const char* name, Qt::WindowFlags fl)
    4. : Q3MainWindow(parent, name, fl)
    5. {
    6. setupUi(this);
    7.  
    8. (void)statusBar();
    9. }
    10. ...
    To copy to clipboard, switch view to plain text mode 
    In my program, I defined a new class as following in TestMainWindow.h

    Qt Code:
    1. #include "mainwindow.h"
    2. ....
    3. class TestMainWindow : public MainWindow
    4. {
    5. Q_OBJECT
    6.  
    7. public:
    8. TestMainWindow ( QWidget* parent = 0, const char* name = 0, Qt::WFlags fl = Qt::WType_TopLevel ); // | WStyle_Customize | WStyle_NoBorder
    9. ~TestMainWindow();
    10.  
    11. ...
    12. }
    To copy to clipboard, switch view to plain text mode 

    In compilation, I always get error that
    c:\project\TestMainWindow.h(19) : error C2504: 'MainWindow' : base class undefined
    I open the "mainwindow.h", it exists and in the include path.

    Could anyone help me find out the problem?

    Thank you very much!

    Richard -
    Last edited by jpn; 27th December 2008 at 12:02. Reason: missing [code] tags

  2. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: Compilation Error: base class undefined in the class created from UI file

    Add
    QMake Code:
    1. QT += qt3support
    To copy to clipboard, switch view to plain text mode 
    to the .pro file and re-run qmake.
    Last edited by wysota; 2nd January 2009 at 23:11. Reason: Changed [code] to [highlight]
    J-P Nurmi

  3. #3
    Join Date
    Dec 2008
    Posts
    68

    Default Re: Compilation Error: base class undefined in the class created from UI file

    Thank you for the input!

    Actually, QT += qt3support, has been added to .PRO file.

    Any other thoughts?

    Thank you!

  4. #4
    Join Date
    Dec 2008
    Posts
    68

    Default Re: Compilation Error: base class undefined in the class created from UI file

    some additional info:

    this error happens when it compiles moc_TestMainwindow.cpp.

    Thank you!

    Richard

Similar Threads

  1. QPSQL problem
    By LoneWolf in forum Installation and Deployment
    Replies: 60
    Last Post: 4th November 2009, 14:22
  2. how to add static library into qmake
    By Namrata in forum Qt Tools
    Replies: 1
    Last Post: 20th November 2007, 17:33
  3. MS Sql native driver??
    By LordQt in forum Qt Programming
    Replies: 4
    Last Post: 9th October 2007, 13:41
  4. error undefined reference ...............
    By amit_pansuria in forum Qt Programming
    Replies: 2
    Last Post: 8th June 2007, 14:28
  5. how to correctly compile threads support?
    By srhlefty in forum Installation and Deployment
    Replies: 9
    Last Post: 25th June 2006, 19:15

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.