PDA

View Full Version : Build errors when using a custom widget in my application



John82
17th November 2009, 17:36
This is a continuation from my previous post :
http://www.qtcentre.org/forum/f-qt-tools-3/t-custom-widget-not-visible-in-integrated-designer-of-qt-creator-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_MainWindow7setupUiEP 11QMainWindow[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.

scascio
17th November 2009, 17:54
Does your file MyClock.h is included in mainwindow.cpp?

John82
17th November 2009, 18:04
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.

John82
17th November 2009, 18:06
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.

scascio
17th November 2009, 20:48
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?