[Qt-interest] how to resolve this moc linker error

Malyushytsky, Alex alex at wai.com
Tue Jul 20 00:22:17 CEST 2010


I would double check that you built mentioned dll with Q_OBJECT macro defined there.
Also it is probably worth to verify that your import / export was defined properly.

As an example piece of code from qt property browser:

#if QT_VERSION >= 0x040400
QT_BEGIN_NAMESPACE
#endif

#if defined(Q_WS_WIN)
#  if !defined(QT_QTPROPERTYBROWSER_EXPORT) && !defined(QT_QTPROPERTYBROWSER_IMPORT)
#    define QT_QTPROPERTYBROWSER_EXPORT
#  elif defined(QT_QTPROPERTYBROWSER_IMPORT)
#    if defined(QT_QTPROPERTYBROWSER_EXPORT)
#      undef QT_QTPROPERTYBROWSER_EXPORT
#    endif
#    define QT_QTPROPERTYBROWSER_EXPORT __declspec(dllimport)
#  elif defined(QT_QTPROPERTYBROWSER_EXPORT)
#    undef QT_QTPROPERTYBROWSER_EXPORT
#    define QT_QTPROPERTYBROWSER_EXPORT __declspec(dllexport)
#  endif
#else
#  define QT_QTPROPERTYBROWSER_EXPORT
#endif


...........................


#include "qtpropertybrowser.h"

#if QT_VERSION >= 0x040400
QT_BEGIN_NAMESPACE
#endif


class QT_QTPROPERTYBROWSER_EXPORT QtButtonPropertyBrowser : public QtAbstractPropertyBrowser
{
    Q_OBJECT
public:
....................

In your project using dll check if you defined QT_QTPROPERTYBROWSER_IMPORT.


Alex


-----Original Message-----
From: Matthias Pospiech [mailto:matthias.pospiech at gmx.de]
Sent: Monday, July 19, 2010 3:05 PM
To: Malyushytsky, Alex
Cc: qt-interest at trolltech.com
Subject: Re: [Qt-interest] how to resolve this moc linker error

Matthias Pospiech schrieb:
> Malyushytsky, Alex schrieb:
>
>> First thing I would check if moc are generated/build with the same compiler version (32 bit, 64 bit , etc).
>>
>>
> Qt is not build with 64 Bit and I use the same Qt Versions in multiple
> projects, so I doubt that that is the reason.
> The thing mainly is, that mainwindow.cpp has a class in the ui called
> QCameraWidget, which is derived from QCameraImage.
> The error thus appears in the base class. QCameraWidget and QCameraImage
> both are part of a DLL, which is loaded in the example where
> mainwindow.cpp is placed.
>
It compiles if I remove the Q_OBJECT from the QCameraImage, but why?


---------------------------------------------------------------------------------------------------
Weidlinger Associates, Inc. made the following annotations.

“This message and any attachments are solely for the intended recipient and may contain confidential or privileged information. If you are not the intended recipient, any disclosure, copying, use, or distribution of the information included in this message and any attachments is prohibited. If you have received this communication in error, please notify us by reply e-mail and immediately and permanently delete this message and any attachments. Thank you.”

“Please consider our environment before printing this email.”




More information about the Qt-interest-old mailing list