Results 1 to 3 of 3

Thread: 2 Questions regarding linking problem (dealing with porting qt3 custom widgets

  1. #1
    Join Date
    Jan 2008
    Posts
    26
    Thanks
    10
    Qt products
    Qt4
    Platforms
    Windows

    Unhappy 2 Questions regarding linking problem (dealing with porting qt3 custom widgets

    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:

    Qt Code:
    1. #include "mycanvasview.h"
    To copy to clipboard, switch view to plain text mode 

    for this:

    Qt Code:
    1. #include "C:\QDevelop\mycanvasviewplugin\mycanvasview.h"
    To copy to clipboard, switch view to plain text mode 

    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.
    Last edited by jacek; 13th February 2008 at 15:47. Reason: changed [code] to [quote]

  2. #2
    Join Date
    Jan 2006
    Location
    Bremen, Germany
    Posts
    466
    Thanked 67 Times in 63 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: 2 Questions regarding linking problem (dealing with porting qt3 custom widgets

    Your first issue hasn't to do something with linking (and also isn't a qt issue). If you don't tell the compiler where to search for header files, it won't find them. Search for 'INCLUDEPATH' or 'HEADERS' in qmake documentation.
    For your second problem - it looks like you did not implement 'MyCanvasView::MyCanvasView(QWidget*, char const*)'

  3. #3
    Join Date
    Jan 2008
    Posts
    26
    Thanks
    10
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: 2 Questions regarding linking problem (dealing with porting qt3 custom widgets

    I added in the .pro file (file used for make) the variables DEPENDPATH and INCLUDEPATH with the directories needed and it worked.

    Thanks!

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.