PDA

View Full Version : QLed undefiene reference QLed(QWidget *widget);



adamatic
12th March 2009, 08:26
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.

wysota
12th March 2009, 10:54
It seems that you didn't include all files after all. The linker can't find the led's constructor.

frix
31st August 2009, 11:13
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

deadleon
23rd August 2010, 09:26
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