[Qt-creator] qt-creator and multiple projects link issue with msvc
Sandro Cavazzoni
s.cavazzoni at adss.it
Wed Jan 27 14:57:37 CET 2010
Il 27/01/2010 13:02, Matthias Pospiech ha scritto:
> Sandro Cavazzoni schrieb:
>> Under linux with gcc i've no problem... it compile my .so objects and
>> after that it compile main binary linking it with my .so
>> Under windows with msvc it doesn't work... it compile correctly my dll
>> but when it compile main binary it cannot link with it because it want
>> a .lib and not a .dll
> The .lib contains information necessary to load the dll.
> A .lib however is only created if your library contains the necessary
> code elements.
> I mean the '__declspec(dllexport)' and the corresponding import one.
> This is only necessary with the msvc compiler. An example is shown here
> http://de.wikipedia.org/wiki/Dynamic_Link_Library#Erstellen_einer_DLL
>
>
> Matthias
Yeah, you put me on the right way.
QT have 2 macros for do this (Q_DECL_EXPORT and Q_DECL_IMPORT).
qt creator prepared for me all the enviroment making a global header
with this code
#if defined(TMCORE_LIBRARY)
# define TMCORESHARED_EXPORT Q_DECL_EXPORT
#else
# define TMCORESHARED_EXPORT Q_DECL_IMPORT
#endif
and putted DEFINES += TMCORE_LIBRARY in my pro file.
I used TMCORESHARED_EXPORT on my class declaration and all compile fine now.
Really thanks
Regards
Sandro
More information about the Qt-creator-old
mailing list