[SailfishDevel] DEFINES in .pro file: Changes require clean to take effect

Lucien XU sfietkonstantin at free.fr
Sat Aug 31 09:24:59 UTC 2013


Hi Christopher

Be sure to run qmake and _rebuild_ your project when you change the defines, 
because the change in pro file needs a recompilation in files containing the 
#ifdef macros.

If you run qmake and rebuild, at least you are sure that you are running the 
files that are using the correct #ifdefs.

Cheers,
Lucien

Le samedi 31 août 2013 10:22:22 christopher.lamb at thurweb.ch a écrit :
> Hi all
> 
> I have a DEFINES QMake directive in my project .pro file which
> (should) allow me to respond to this with #if #ifdef C++ preprocessor
> macros in my main.cpp file.
> 
> Let assume I have the following
> 
> //.pro file
> DEFINES += TEST_A
> 
> //main.cpp
> #ifdef TEST_A
>     //Do Something
> #endif
> 
> #ifdef TEST_B
>     //Do Something different
> #endif
> 
> I build and run my code. As expected, "Something" happens, "Something
> different" does not.
> 
> I then change the pro file
> 
> DEFINES += TEST_B
> # DEFINES += TEST_A
> 
> and build and run again. I expect "Something" to be skipped and
> "Something different" to happen.
> 
> Instead the "Something" happens. i.e. it is as if I made no change to
> the .pro file.
> 
> If I then clean the project, and build and run again, then I get the
> expected results "Something different".
> 
> i.e. changes to the DEFINES setting only take effect once a project
> has been cleaned.
> 
> I suspect that this is a more general Qt / QMake problem rather than a
> Sailfish specific one.
> 
> I am running the Sailfish Alpha 2 (Qt5) hosted on OSX.
> 
> Grüsse
> 
> Chris
> 
> 
> 
> 
> _______________________________________________
> SailfishOS.org Devel mailing list


More information about the Devel mailing list