>I'm getting the error '#include nesting overflow' when trying to
>compile a project in Codewarrior. I've read other posts about this
>problem and have checked over and over again that every single one of
>my header files has a '#pragma once' at the top. I've looked for
>circular/self includes in both headers and cpp files. I've checked
>every #ifdef statement and made sure it was balanced with an #endif.
You may be including a source file more than once and getting this. It
is not uncommon now for a source file to include an implementation file.
There are two versions of this pragma: #pragma once and #pragma once
on.
Use #pragma once in a header file to ensure that the header file is
included only once in a source file.
Use #pragma once on in a header file or source file to insure that any
file is included only once in a source file.
Beware that when using #pragma once on, precompiled headers might not
necessarily transfer from machine to machine and provide the same
results. This is because the full paths of included files are stored to
distinguish between two distinct files that have identical filenames
but different paths. Use the warn_pch_portability pragma to issue a
warning when #pragma once on is used in a precompiled header. For more
information, see ³warn_pch_portability² on page221.
>Oddly I can remove one of the higher level files and then the project
>builds fine. However there is nothing special or different about the
>file, it just inludes one single file that is already in the project. I
>don't get it.
You shouldn't include that second file in the target, click on the
target column and remove it as part of the target and see if that
solves the problem
>Does anyone have any suggestions what I could do? Are there any
>utilities that would help chart include dependencies or find circular
>references I may have missed? Short of replacing every #pragma once
>with a custom #ifndef...#def for each header, I'm at a loss what to do.
Preprocess might help you.
Ron

Signature
CodeWarrior Community Forum is a free online resource for developers
to discuss CodeWarrior topics with other users and our staff
-- http://www.codewarrior.com/community --
Ron Liechty - ron.liechty@freescale.com - http://www.codewarrior.com
steve@walkereffects.com - 07 Dec 2005 04:53 GMT
Hi Ron,
Thank you for the thorough reply. I will try your suggestions and
report back as to what worked.
Thanks,
Walker
steve@walkereffects.com - 07 Dec 2005 18:46 GMT
Ok, after many hours of tedious work I have finally fixed the problem.
Unfotunately I am not that much wiser as to what the problem was.
First I tried using '#pragma once on' in addition to '#pragma once'. I
put the 'on' version in every implementation file and in every file
where I was including system header files. Perhaps I missed the point
of how it is supposed to work, because it did not make any difference.
Then I painstakingly added an #ifndef...def to every header file and
removed the pragmas. This did not fix the problem either.
Then I turned my attention to where system header files are inlcuded.
There are only a few places that include system headers and they are
fairly low level in my codebase. So I pooled them all together at the
lowest level include file in my framework. This solved the problem,
though I do not understand why.
One point I never mentioned in the original post is that Xcode never
had a problem with my files. I could build projects from the same code
and it didn't give any warnings or errors. I think it must be something
specific to Codewarrior.
At least now my project is compiling again in Codewarrior. At some
point I may return to using #pragma once since I don't think that was
the problem originally, but I've had enough tedium for a while ;)
Thanks for the help.
Walker
> Does anyone have any suggestions what I could do? Are there any
> utilities that would help chart include dependencies or find circular
> references I may have missed? Short of replacing every #pragma once
> with a custom #ifndef...#def for each header, I'm at a loss what to do.
Using the Preprocess command on the file in question is likely to produce
something from which the answer to your problem can be deduced, but I haven't
tried it myself.
hth
Ben

Signature
If this message helped you, consider buying an item
from my wish list: <http://artins.org/ben/wishlist>
I changed my name: <http://periodic-kingdom.org/People/NameChange.php>