Results 1 to 1 of 1

Thread: Problems when deriving from Qwt classes in an app (Qwt 6.1.0 compiled with MSVC 2010)

  1. #1
    Join Date
    Jun 2014
    Posts
    16
    Thanks
    1
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: Problems when deriving from Qwt classes in an app (Qwt 6.1.0 compiled with MSVC 2

    I am using Qwt 6.1.0 compiled with MSVC 2010 with the following commands:

    qmake qwt.pro "QWT_CONFIG+=QwtExamples QwtPlayground"
    jom -j 3
    del /s *.obj

    All is fine - I can use from my app any Qwt class. But when I derive from a Qwt class that in second order is QObject descendant, I have linking error. Example:

    SignalPlotWidget.h - file from my app:

    #include <qwt_plot.h>

    class Plot : public QwtPlot
    {
    Q_OBJECT
    typedef QwtPlot Base;

    public:
    explicit Plot(QWidget* parent = 0) : Base(parent) {}
    explicit Plot(const QwtText& title, QWidget* parent = 0) : Base(title, parent) {}

    virtual ~Plot() {}
    };

    The error:

    moc_SignalPlotWidget.obj : error LNK2001: unresolved external symbol "public: static struct QMetaObject const QwtPlot::staticMetaObject" (?staticMetaObject@QwtPlot@@2UQMetaObject@@B)

    Both the Qwt and the app are compiled with MSVC 2010. Both static and dynamic Qwt linking to the app were tried.

    There is no such problem with MinGW 4.8.

    The error looks as there is no Qt meta object info in compiled Qwt. How is it formed?

    Thanks

    I said with an error: I tried only dynamic version of Qwt (there is my lib in the app with switch static/dynamic).

    The problem lies in QWT_EXPORT macro. An app if it uses dynamic Qwt, must specify QWT_DLL macro to turn in QWT_EXPORT proper expansion (to __declspec(dllimport)).

    The problem is solved now.
    Last edited by Alekon; 19th November 2014 at 08:54.

Similar Threads

  1. Why is Qt 5.3.0 for MSVC 2013 shipped with the MSVC 2010 redist?
    By bryanburke in forum Installation and Deployment
    Replies: 1
    Last Post: 3rd June 2014, 00:58
  2. Problems building Qt 5 static with MSVC 2010
    By prophetofreason in forum Installation and Deployment
    Replies: 1
    Last Post: 28th January 2013, 17:45
  3. Replies: 3
    Last Post: 20th September 2010, 22:36
  4. Plan for Visual Studio 2010 (MSVC 2010)?
    By Vinzz in forum Qt Programming
    Replies: 1
    Last Post: 18th April 2010, 17:42
  5. Problem with compiling Qt 4.6 via MSVC 2010 Beta2 (win32-msvc specs)
    By Erik-Moscow in forum Installation and Deployment
    Replies: 2
    Last Post: 17th December 2009, 18:44

Tags for this Thread

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.