Results 1 to 2 of 2

Thread: Linker error when creating custom Property Browser components

  1. #1
    Join Date
    Feb 2010
    Location
    Sydney, Australia
    Posts
    111
    Thanks
    18
    Thanked 5 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Linker error when creating custom Property Browser components

    I'm trying to extend QtPropertyBrowser to accept custom types. I've been following the guide here.

    Qt Code:
    1. class CCustomPropertyFactory : public QtVariantEditorFactory {
    2. ...
    3. }
    To copy to clipboard, switch view to plain text mode 

    Qt Code:
    1. class CCustomPropertyManager : public QtVariantPropertyManager {
    2. ...
    3. }
    To copy to clipboard, switch view to plain text mode 

    I'm getting the following linker error when building my code though:

    1>------ Build started: Project: MockClient, Configuration: Debug Win32 ------
    1>Linking...
    1> Creating library C:\***Client.lib and object C:\***Client.exp
    1>clientlib.lib(moc_CCustomPropertyFactory.obj) : error LNK2001: unresolved external symbol "public: static struct QMetaObject const QtVariantEditorFactory::staticMetaObject" (?staticMetaObject@QtVariantEditorFactory@@2UQMeta Object@@B)
    1>clientlib.lib(moc_CCustomPropertyManager.obj) : error LNK2001: unresolved external symbol "public: static struct QMetaObject const QtVariantPropertyManager::staticMetaObject" (?staticMetaObject@QtVariantPropertyManager@@2UQMe taObject@@B)
    1>C:\***Client.exe : fatal error LNK1120: 2 unresolved externals
    1>Build log was saved at "file://c:\****\Debug\BuildLog.htm"
    1>MockClient - 3 error(s), 0 warning(s)
    ========== Build: 0 succeeded, 1 failed, 3 up-to-date, 0 skipped ==========


    It looks like there is a reference to the staticMetaObject in moc_CCustomPropertyFactory.cpp.

    Qt Code:
    1. const QMetaObject Epoch::CCustomPropertyFactory::staticMetaObject = {
    2. { &QtVariantEditorFactory::staticMetaObject, qt_meta_stringdata_Epoch__CCustomPropertyFactory,
    3. qt_meta_data_Epoch__CCustomPropertyFactory, 0 }
    4. };
    To copy to clipboard, switch view to plain text mode 

    But staticMetaObject is only declared (in qobject.h) if qdoc is defined. Should qdoc be defined?

    Qt Code:
    1. #ifdef qdoc
    2. static QString tr(const char *sourceText, const char *comment = 0, int n = -1);
    3. static QString trUtf8(const char *sourceText, const char *comment = 0, int n = -1);
    4. virtual const QMetaObject *metaObject() const;
    5. static const QMetaObject staticMetaObject;
    6. #endif
    To copy to clipboard, switch view to plain text mode 

    I'm using Qt 4.6.2, QtPropertyBrowser 2.5.1, VS 2008, Windows 7.

    Any help would be much appreciated.

    Thanks
    Stefan

  2. #2
    Join Date
    Feb 2010
    Location
    Sydney, Australia
    Posts
    111
    Thanks
    18
    Thanked 5 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Linker error when creating custom Property Browser components

    I've managed to get around this issue by building QtPropertyBrowser as a static rather than dynamic library and it now works fine in my main project. I suppose this suggests that the problem with dll import-/export and is possibly somehow linked to QT_QTPROPERTYBROWSER_IMPORT/QT_QTPROPERTYBROWSER_EXPORT, which seems to have caused some problems in the past.

Similar Threads

  1. Compilation of QT Property Browser
    By yccheok in forum Qt Programming
    Replies: 7
    Last Post: 29th July 2010, 00:39
  2. Qt Creator Adding a Help File (for the Property Browser)
    By BobTheProg in forum Qt Tools
    Replies: 5
    Last Post: 30th January 2010, 00:44
  3. Qt Property Browser Framework - Redo/Undo
    By monadic_kid in forum Qt Programming
    Replies: 2
    Last Post: 3rd December 2009, 11:46
  4. Realisation of Property Editor (Browser) in Qt Jambi
    By Pavka in forum Qt Programming
    Replies: 0
    Last Post: 30th January 2009, 08:11
  5. Adding property editor file browser popup...
    By thawkins in forum Qt Tools
    Replies: 1
    Last Post: 26th April 2007, 00:03

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.