In an auto-generated file, in particular files generated by the ui designer, include files are put in a certain order. The problem with the generated order is, that this order is contrary to a number of published recommendations for including .h files in .cpp files.

The worst problem is that a given xxx.cpp file should include it's own xxx.h file as the first file. This prevents a number of problems from occuring (see for instance Lakos, "Large scale C++ Software design"). In short, if the xxx.cpp file includes it's xxx.h file as the first include file, the .h file will present the smallest possible physical interface to clients, with all kinds of beneficial effects, recompilation speed as one of them.

Sander van der Wal