[Qt-creator] qmake and precompiler directives

Duane duane.hebert at group-upc.com
Wed Oct 2 19:22:51 CEST 2013


Does qmake respect compiler directives?

I have some old broken code that I have to support.  In it they include 
a cpp file directly.  I've changed it to use the proper header files 
etc. but this same code is used in an old build system.  Anyway, long 
story short we share the same svn and I can't make their thing stop 
working.  So I've added a define for us to build it correctly.
But when qmake is run, it doesn't pay attention to it.

For example, I have

#ifdef  MYDEFINE
#include spoo.h
#else
#include spoo.cpp
#endif


When I defined MYDEFINE in the pro file, the build gave me unresolved 
externs for functions in spoo.cpp.  I looked at the Makefile and saw 
that there was no change and it was not building spoo.o.

I commented out the include for the cpp file and ran qmake.  Then I see 
the make file has a line to build spoo.o.

After this I can remove my comments and build, rebuild clean whatever 
and it works.  If I run qmake again it breaks.





More information about the Qt-creator mailing list