PDA

View Full Version : Is there a difference between the two types of coding(for Header File)??



rezas1000
17th August 2014, 16:48
Hello

Is using the code below


#include <QtWidgets>

There are certain differences with the following code????:


#include <QWidget>
#include <QLabel>
#include <QTextEdit>
#include <QMenu>
.......
.......


thanks.

anda_skoa
17th August 2014, 17:27
The first one is a module include, it indirectly includes all headers of the respective module, in this case QtWidgets.
The second option is including each type individually.

I wouldn't recommend using the frist one outside of small test programs or prototyping.
Including all headers means that the compiler will have to parse a lot of declarations that it then doesn't need, i.e. a waste of build time.


Cheers,
_