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

christopher.lamb at thurweb.ch christopher.lamb at thurweb.ch
Sat Aug 31 08:22:22 UTC 2013


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






More information about the Devel mailing list