Results 1 to 4 of 4

Thread: QLed undefiene reference QLed(QWidget *widget);

  1. #1
    Join Date
    Jan 2009
    Posts
    54
    Thanks
    9
    Qt products
    Qt4
    Platforms
    Windows

    Default QLed undefiene reference QLed(QWidget *widget);

    Hello.

    I am using the qled apps and I have the following problem when i use the constructor QLed:

    undefined reference to `_imp___ZN4QLedC1EP7QWidget'

    I dont know what i am doing wrong because this the process which i followed:

    - Download the apps QLed from the trolltech web.
    - Compiled the apps.
    - I included all the files and my projecto.
    - I defined and object QLed l = new QLed (QWidget)

    Can someone see the problem?

    Note: I am using qt 4.4.4 integrated with Eclipse.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QLed undefiene reference QLed(QWidget *widget);

    It seems that you didn't include all files after all. The linker can't find the led's constructor.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Aug 2009
    Posts
    1

    Smile Re: QLed undefiene reference QLed(QWidget *widget);

    Good day,
    You'll get this problem if you haven't specified in the .pro file or your application that it should link against the specific plugin.

    Just add to your .pro file:
    LIBS += -lqledplugin

    This should remove the link error in:
    Win32: undefined reference to `_imp___ZN4QLedC1EP7QWidge`
    Linux: Undefined reference to `QLed::QLed(Widget*)`

    Also, the locations used by QT Creator and the compiler may be different.
    It seems that {QT_base_path}/qt/plugins/designer is used by QT Creator and that
    {QT_base_path}/qt/lib is used by the linker during compile time.
    I just copied qledplugin.dll to both locations and that solved the problem for me.

    Also, remember to copy 'qled.h' to {QT_base_path}/qt/include, otherwise you'll get a compiler error: "qled.h: No such file or directory"

    Note: If you're using the Win32 version of the precompiled SDK (2009.03) from Nokia, you woun't be able to use these plugins/custom widgets at all. The reason is documented at http://labs.trolltech.com/forums/topic/1068. It basically comes down to the fact that QTCreator is build with MSVC and the rest of the SDK is build with MinGW. To solve this problem, get the QT Creator source along with the SDK, install the SDK and use it to recompile QT Creator with MinGW. Quite a bit of trouble, but at least the build compiles cleanly.

    Regards,
    Frikkie Thirion

  4. #4

    Default Re: QLed undefiene reference QLed(QWidget *widget);

    there is some warning in qt creator,any solutions? i use qt creator with qledplugin ,but can not debug my app with it。
    the app exited with code -1073741515


    “QLed::staticMetaObject”Rede clared without dllimport attribute after being referenced with dll linkage

    “vitual const QMetaObject* QLed::metaObject() const”Redeclared without dllimport attribute :previous dllimport ignored


    “vitual void* QLed::qt_metacast(const char*)”Redeclared without dllimport attribute :previous dllimport ignored

    “vitual int QLed::qt_metacall(QMetaObject::Call ,int,void**)”Redeclared without dllimport attribute :previous dllimport ignored

Similar Threads

  1. QPSQL problem
    By LoneWolf in forum Installation and Deployment
    Replies: 60
    Last Post: 4th November 2009, 14:22
  2. how to add static library into qmake
    By Namrata in forum Qt Tools
    Replies: 1
    Last Post: 20th November 2007, 17:33
  3. MS Sql native driver??
    By LordQt in forum Qt Programming
    Replies: 4
    Last Post: 9th October 2007, 13:41
  4. error undefined reference ...............
    By amit_pansuria in forum Qt Programming
    Replies: 2
    Last Post: 8th June 2007, 14:28
  5. how to correctly compile threads support?
    By srhlefty in forum Installation and Deployment
    Replies: 9
    Last Post: 25th June 2006, 19:15

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.