include files

Andi Hellmund
Wed Aug 17 22:35:00 GMT 2011

Hi Jason,

> Hello I have a problem, I have 2 header files that need to include
> each other (engine.h&  controller.h).
This is problematic because you'll end up including the files endlessly. 
You might then see this error:

1.h:1:15: error: #include nested too deeply

> However when I try to compile it
> never seems to include controller.h in engine.h when controller.h
> includes engine.h.
I think that the header files are using include guards to NOT include 
the same file multiple times. An include guard looks like this:


<content of header file>


> To get this to work correctly what do I have to do ? ( make changes to
> the preprocessors perhaps ?)
Well, I think that you already include these two files, but maybe the 
logic in your header files is not correct.

What is your exact problem/error message that you face?

Best regards,

More information about the Gcc-help mailing list