Defining preprocessor macros in pro file
-
hi everyone,
I defined many macros in pro file each of them in project file , (I am trying to implement Qt Assistant topic creating shared libs)
@ #include <QtCore/QtGlobal>
#if defined(MYSHAREDLIB_LIBRARY)
define MYSHAREDLIB_EXPORT Q_DECL_EXPORT
#else
define MYSHAREDLIB_EXPORT Q_DECL_IMPORT
#endif@
one of them always defines Q_DECL_IMPORT instead Q_DECL_EXPORT , I spent alot of time tracking the code, syntax, but in vain.
-
Hi.
I don't if this help, but anyway.
In your .pro file you will have
@DEFINES += MYSHAREDLIB_LIBRARY@
this means that when you are compiling your program, whenever the compiler reads
@MYSHAREDLIB_EXPORT@
it will replace with
@Q_DECL_EXPORT@and when you run your applicacion,
@MYSHAREDLIB_LIBRARY@
is not defined, so it will replace
@MYSHAREDLIB_EXPORT@
with
@Q_DECL_IMPORT@sorry if it was not your doubt. i did not understand you question anyway.
:D -
thank you luisvaldes88 for reply
but the proposed way that macros are intended to work is:
in the same project
@MYSHAREDLIB_EXPORT@
should be @Q_DECL_EXPORT@out side the project
should be @Q_DECL_IMPORT@I think it is qmake issue because of the dependencies between the libs , I noticed that the calling libs (which use the base) built first although the base lib qmaked first