[Qt-interest] How to use my own static lib in another project?
Yao Huiji
spideryao at gmail.com
Tue May 19 16:48:27 CEST 2009
2009/5/19 Stephen Collyer <scollyer at netspinner.co.uk>
> 2009/5/19 Yao Huiji <spideryao at gmail.com>
>
>> hi,
>>
>>
>>> class Q_DECL_EXPORT Settings : public QObject
>>
>>
> How is Q_DECL_EXPORT defined ? It should be
> defined as __declspec(dllexport) when you are building the
> library, and __declspec(dllimport) when you are using
> the header file in another compilation unit.
>
> If you don't define Q_DECL_EXPORT correctly when you build
> the library, then none of the symbols in the class will be exported
> in the dll, and so they will not be available when you link against
> the dll. This could explain what you are seeing.
>
> --
> Stephen Collyer
>
thank you for your reply.
I edit my code , incude the "settings_global.h" file generated by vs qt
project template, and add "SETTINGS_LIB" to "DEFINES" section
#ifdef SETTINGS_LIB
> # define SETTINGS_EXPORT Q_DECL_EXPORT
> #else
> # define SETTINGS_EXPORT Q_DECL_IMPORT
> #endif
but it still does not work when I use the lib file in another project, the
error message is :
error LNK2019: unresolved external symbol "__declspec(dllimport) public:
> __declspec(dllimport) public: __thiscall Settings::Settings(void)"
> (__imp_??0Settings@@QAE at XZ) referenced in function _main
can you help me ? ;-(
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090519/d951d61c/attachment.html
More information about the Qt-interest-old
mailing list