Results 1 to 8 of 8

Thread: undefined reference to `QUiLoader::QUiLoader(QObject*)'

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Aug 2007
    Location
    Gorakhpur, India
    Posts
    254
    Thanks
    8
    Thanked 14 Times in 14 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Exclamation undefined reference to `QUiLoader::QUiLoader(QObject*)'

    Dear Sir!
    The following error occurs when I make the project.

    Qt Code:
    1. mywidget.o: In function `MyWidget::MyWidget(QWidget*)':
    2. mywidget.cpp:(.text+0x48): undefined reference to `QUiLoader::QUiLoader(QObject*)'
    3. mywidget.cpp:(.text+0xb5): undefined reference to `QUiLoader::load(QIODevice*, QWidget*)'
    4. mywidget.cpp:(.text+0x119): undefined reference to `QUiLoader::~QUiLoader()'
    5. mywidget.cpp:(.text+0x153): undefined reference to `QUiLoader::~QUiLoader()'
    6. mywidget.o: In function `MyWidget::MyWidget(QWidget*)':
    7. mywidget.cpp:(.text+0x1c8): undefined reference to `QUiLoader::QUiLoader(QObject*)'
    8. mywidget.cpp:(.text+0x235): undefined reference to `QUiLoader::load(QIODevice*, QWidget*)'
    9. mywidget.cpp:(.text+0x299): undefined reference to `QUiLoader::~QUiLoader()'
    10. mywidget.cpp:(.text+0x2d3): undefined reference to `QUiLoader::~QUiLoader()'
    11. collect2: ld returned 1 exit status
    To copy to clipboard, switch view to plain text mode 

    //mywidget.h code is as follows
    Qt Code:
    1. #ifndef MYWIDGET_H
    2. #define MYWIDGET_H
    3. #include <QtGui>
    4.  
    5. class MyWidget: public QDialog
    6. {
    7. Q_OBJECT
    8.  
    9. public:
    10. MyWidget(QWidget *parent = 0);
    11.  
    12. };
    13. #endif //MYWIDGET_H
    To copy to clipboard, switch view to plain text mode 

    //mywidget.cpp code as follows;

    Qt Code:
    1. #include "mywidget.h"
    2. #include <QtUiTools/QUiLoader>
    3. #include <QFile>
    4. MyWidget::MyWidget(QWidget *parent)
    5. : QDialog(parent)
    6. {
    7. QUiLoader loader;
    8. QFile file("dlgtextscroller.ui");
    9. file.open(QFile::ReadOnly);
    10. QWidget *myWidget = loader.load(&file, this);
    11. file.close();
    12.  
    13. QVBoxLayout *layout = new QVBoxLayout;
    14. layout->addWidget(myWidget);
    15. setLayout(layout);
    16. }
    To copy to clipboard, switch view to plain text mode 

    //main.cpp code
    #include <QApplication>
    #include "mywidget.h"

    int main(int argc, char **argv)
    {
    QApplication app(argc,argv);
    MyWidget *dialog=new MyWidget;
    dialog->show();

    return app.exec();
    }

    What is wrong in this?
    Attached Files Attached Files
    Anurag Shukla
    A man who never makes mistake is the man who never does anything! Theodre Rosvelt!

Similar Threads

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

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.