Gang,
I’m porting old code from Codewarrior to Xcode 2.2
(not using the project importer, just building a new xcode project from
scratch) and I have a problem with typedefs. This is all C++ code
and I have set Xcode to always use the C++ compiler.
In a .h file I have a typedef:
typedef unsigned char
*PascalStringPtr;
I have another .h file that includes the above .h file and
then in a class declaration uses the new type PascalStringPtr:
Class String
{
PascalStringPtr fString;
…
};
Xcode complains that PascalStringPtr “does not name a
type”.
After some futzing around I found out that:
- Xcode is indeed “reaching”
the typedef: I put #error before and after the typedef and both errors are
spit out by Xcode; however:
- Xcode isn’t really “consuming”
the typedef: I changed it to “typedef GregorianChant
*PascalStringPtr;” and Xcode did not complain about that at all –
and I feel confident there’s no inherent C type of “GregorianChant”!!!
J
So what the heck is going on here?!?!?
I did some searching and found a posting (http://gcc.gnu.org/ml/gcc-help/2005-06/msg00097.html)
about someone who had a similar experience and the issue was related to an X.h
file including a Y.h file which itself then included X.h, etc.
I don’t have my code at this computer so I can’t
test this out today. My .h files are ALL protected with :
#ifndef __FOO__
#define __FOO__
…
#endif
…which should preclude a lot (but not necessarily all)
of nested and incestuous .h file inclusion problems.
Can anyone shed any light on this problem? Is it
indeed .h files including other .h files that then include the original .h
file?
Is there any compiler setting I can play with to work around
this? Do I have to re configure my #includes?
Any insight is very much appreciated…
Thx,
Ando