Results 1 to 5 of 5

Thread: Build errors when using a custom widget in my application

  1. #1
    Join Date
    Jul 2009
    Posts
    28
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Question Build errors when using a custom widget in my application

    This is a continuation from my previous post :
    http://www.qtcentre.org/forum/f-qt-t...tor-25741.html

    After creating a custom widget called "MyClock", I added it to a form and tried to compile it. But unfortunately I am getting build errors :

    mainwindow.cpp.text._ZN13Ui_MainWindow7setupUiEP11QMainWindow[Ui_MainWindow::setupUi:-1: error: undefined reference to `MyClock::MyClock(QWidget*)'
    I added the include path of MyClock.h to the build environment, but the generated Makefile is not reflecting this path.

    On a sidenote, I tried adding some of the example plugins like tic tac toe and world clock provided in the Display Widgets [ Examples ] group of Qt Designer. All of them give me the same errors while trying to build the app.

  2. #2
    Join Date
    Sep 2009
    Posts
    140
    Thanks
    4
    Thanked 17 Times in 17 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Build errors when using a custom widget in my application

    Does your file MyClock.h is included in mainwindow.cpp?

  3. #3
    Join Date
    Jul 2009
    Posts
    28
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Build errors when using a custom widget in my application

    No only in ui_mainwindow.h. Since I am not doing anything in mainwindow.cpp, I thought the autogenerated code was enough. I will add it and get back.

  4. #4
    Join Date
    Jul 2009
    Posts
    28
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Build errors when using a custom widget in my application

    No..that was not the problem. I am still getting the same errors. And like I said, I get the errors when adding qt provided plugin widgets like Analog Clock etc. I must be missing something in the Build environment.

  5. #5
    Join Date
    Sep 2009
    Posts
    140
    Thanks
    4
    Thanked 17 Times in 17 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Build errors when using a custom widget in my application

    The message you got is a link error. It means that you miss the definition of the MyClock constructor.

    I dont use plugins so I can't help you.
    But it is sure that you need to link against your plugin, since it is a library, isn't it?

Similar Threads

  1. Replies: 3
    Last Post: 17th November 2009, 14:43
  2. Compile Errors (porting Custom widget from Qt3 to Qt4)
    By degs2k4 in forum Qt Programming
    Replies: 3
    Last Post: 7th February 2008, 22:18
  3. Custom widget - Only works in Designer
    By Darhuuk in forum Qt Tools
    Replies: 6
    Last Post: 8th January 2008, 00:46
  4. Custom Widget Plugin Analog Clock
    By kemp in forum Qt Programming
    Replies: 8
    Last Post: 11th August 2006, 13:22
  5. Replies: 3
    Last Post: 12th April 2006, 08:20

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.