Brett McCoy wrote:
> On Thu, Mar 13, 2008 at 6:26 AM, gupta.beeru <[EMAIL PROTECTED]> wrote:
> 
>>  I am a beginner so please reply me in easy way so that i will get
>>  properly.THANKS!
>>  Let, There is a header file 'A.h'. Inside which another file 'B.h' is
>>  included already. and Inside 'B.h' another file 'C.h' exists. To
>>  include these files the sequence must be as follows...
>>  #include"C.h"
>>  #include"B.h"
>>  #include"A.h"
>>
>>  Now problem is occuring when in the same case 'C.h' consists again
>>  header file 'A.h'. Now what should be the sequence to include header
>>  files.
> 
> First, search Google for 'circular header references' -- this is a
> common design problem and there are several ways to get around the
> problem.
> 
> My personal opinion is that if you find yourself using headers like
> this, it's time to rethink your design.
> 
> -- Brett

Application layer:  One header #include for the Base library.  Haven't 
figured out the rest - varies depending on application, but I prefer one 
central header file.

Base library layer:  Multiple #includes where each .cpp uses one master 
header #include but each .cpp file has its own .h.  Precompiled headers 
come in real handy (the master header ends up being #include soup).

It is a pretty simple setup and eliminates the need for "header guards". 
  Something that is declared somewhat of a "necessary evil" around these 
parts.  It also eliminates the annoyance of compiling and the compiler 
reminding me that I'm missing a header.  The downside is that compile 
time increases significantly (I use precompiled headers wherever possible).

-- 
Thomas Hruska
CubicleSoft President
Ph: 517-803-4197

*NEW* MyTaskFocus 1.1
Get on task.  Stay on task.

http://www.CubicleSoft.com/MyTaskFocus/

Reply via email to