We usually receive complaints come from the compiler that can find class definition included in the .h file. But we do add the head file in the corresponding cpp file. There does the complaint comes from?
To examine the problem, we need to go through the whole process of compile.
First the compiler compiles each of the CPP file into an objective code(.obj) individually, then all the obj file will be linked into an executable code(.exe).
Back to the question, though we add head file in the corresponding cpp file, the head file may be used in other cpp file, maybe the main dialog CPP file. The dialog CPP file will load all the head file by the include order. If an included head file uses some classes defined in other head file, we must put those head files ahead. So just go through all the place where the head file appeared, and include needed head files first, the problem will be solved.
When we design a head file,
1. Avoid including other head file to make the head file simple and easy to use.
2. Attention to the order of head files, and put the base head file first.