I have two header files named Secure.h and FileMgt.h. To encrypt the File while saving i use Secure.h in FileMgt.h and in FileMgt.h i have declared some structure which is needed by Secure.h.The FileMgt.h is again include in another file called ElecB.h. I have used header guards in all the Files. The Problem is FileMgt.h is First included in ElecB.h. Since this file is already included in ElecB.h. Now its not including again in Secure.h. Please give me Solution for this. Thanks in advance.
Asked
Active
Viewed 148 times
0
-
3Smells of classical circular dependency problems. – Alok Save Apr 06 '14 at 05:02
-
1Maybe this thread will help http://stackoverflow.com/questions/625799/resolve-circular-dependencies-in-c – Tahlil Apr 06 '14 at 05:04
-
create a separate header file and place structure in that and include it in both Secure.h and FileMgt.h . – CrazyC Apr 06 '14 at 05:05
-
Its better to use forward declaration instead of including a header file in a header files. – Tahlil Apr 06 '14 at 05:08
-
Forward declaration can used only when a pointer of structure has been used otherwise need the complete declaration. – CrazyC Apr 06 '14 at 05:24
1 Answers
1
Declare the structure in a third header file (with include guards) and include it in both Secure.h and FileMgt.h

Spunk
- 28
- 1
- 7