Results 1 to 4 of 4

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

Threaded View

Previous Post Previous Post   Next Post Next Post
  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 13:02. Reason: missing [code] tags

Similar Threads

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