During header file writing
There are some class qfile and other things that seem to be declared... for example below
# Ifndef window_h
# Define window_h
Qt_begin_namespace
Class qtcpserver;
Class qtcpsocket;
Class qprogressbar;
Class qlabel;
Class qdialogbuttonbox;
Class qfile;
Qt_end_namespace
// Code end
Class qaction;
Class qcheckbox;
...
If no declaration is made, an error similar to the following will occur.
Iso c ++ forbids declaration of 'qfile' with no type
So what is this ????
This is because only the pointer declarations of these classes are in the header file and are not actually instantiated. In the CPP file corresponding to this header file
# Include <
Qdialogbuttonbox
>
# Include <
Qfile
>
...
These classes will be instantiated in the CPP file.
It is directly in the header file # include <
Qdialogbuttonbox>
# Include <
Qfile> It is also possible, like this, it seems that it can reduce the relevance of each file during compilation and will not introduce
The re-Compilation of a large number of other files makes no difference when doing small projects, but it takes several hours to compile the files. The advantage of this is obvious.