degs2k4
13th February 2008, 13:21
Hello,
I am porting a custom Qt3 widget (named MyCanvasView)to Qt4 using QDevelop under windows. I will explain carefully the problem:
Both the widget and the plugin compiled fine, and are in the same project directory (C:\QDevelop\mycanvasviewplugin). Next, I just put the generated .a and .dll files inside the C:\Qt\4.3.2\plugins\designer folder.
Then I just created a new project with QDevelop for using the ported widget. Next I just edit the ui file of the project in QTDesigner, adding the custom widgets. Both signals and slot of the custom widget are recognized in the signals/slots editor. Everything seems OK up to now.
Then I save the file and go back to QDevelop. I just try to compile the project and gives me the folowing error:
build/ui_mainwindow.h: In member function `void Ui_MainWindow::setupUi(QMainWindow*)':
build/ui_mainwindow.h:74: error: `canvasview' was not declared in this scope
build/ui_mainwindow.h:74: error: `MyCanvasView' has not been declared
Which means that it can't find the MyCanvasView. I just opened the file ui_mainwindow.h file and replaced this:
#include "mycanvasview.h"
for this:
#include "C:\QDevelop\mycanvasviewplugin\mycanvasview.h"
so that it can find the .h of the custom widget. But editing this file is very bad since any changes will be lost when recompiling the faile.
Question 1: Why it can't find the .h of the custom widget? Is there any other way of solving this? Maybe on linking options?
Now the previous error is gone, but instead I get now this error:
build\mainwindowimpl.o:mainwindowimpl.cpp:(.text$_ ZN13Ui_MainWindow7setupUiEP11QMainWindow[Ui_MainWindow::setupUi(QMainWindow*)]+0xa68): undefined reference to `MyCanvasView::MyCanvasView(QWidget*, char const*)'
collect2: ld returned 1 exit status
which means that it can't find the constructor. No idea on how to solve this one.
Question 2: How to solve this? Again, I think it is a problem of linking...Even if I add explicitely all the files of the c. widget, it gives hundreds of undefined reference errors...
Thanks to everyone again.
I am porting a custom Qt3 widget (named MyCanvasView)to Qt4 using QDevelop under windows. I will explain carefully the problem:
Both the widget and the plugin compiled fine, and are in the same project directory (C:\QDevelop\mycanvasviewplugin). Next, I just put the generated .a and .dll files inside the C:\Qt\4.3.2\plugins\designer folder.
Then I just created a new project with QDevelop for using the ported widget. Next I just edit the ui file of the project in QTDesigner, adding the custom widgets. Both signals and slot of the custom widget are recognized in the signals/slots editor. Everything seems OK up to now.
Then I save the file and go back to QDevelop. I just try to compile the project and gives me the folowing error:
build/ui_mainwindow.h: In member function `void Ui_MainWindow::setupUi(QMainWindow*)':
build/ui_mainwindow.h:74: error: `canvasview' was not declared in this scope
build/ui_mainwindow.h:74: error: `MyCanvasView' has not been declared
Which means that it can't find the MyCanvasView. I just opened the file ui_mainwindow.h file and replaced this:
#include "mycanvasview.h"
for this:
#include "C:\QDevelop\mycanvasviewplugin\mycanvasview.h"
so that it can find the .h of the custom widget. But editing this file is very bad since any changes will be lost when recompiling the faile.
Question 1: Why it can't find the .h of the custom widget? Is there any other way of solving this? Maybe on linking options?
Now the previous error is gone, but instead I get now this error:
build\mainwindowimpl.o:mainwindowimpl.cpp:(.text$_ ZN13Ui_MainWindow7setupUiEP11QMainWindow[Ui_MainWindow::setupUi(QMainWindow*)]+0xa68): undefined reference to `MyCanvasView::MyCanvasView(QWidget*, char const*)'
collect2: ld returned 1 exit status
which means that it can't find the constructor. No idea on how to solve this one.
Question 2: How to solve this? Again, I think it is a problem of linking...Even if I add explicitely all the files of the c. widget, it gives hundreds of undefined reference errors...
Thanks to everyone again.