Header import nightmare
Header import nightmare
- Subject: Header import nightmare
- From: Bas Scheffers <email@hidden>
- Date: Sun, 17 Jun 2007 12:57:36 +0930
Hi,
I have two classes (well, I have more, but to simplify the problem I
focus on these two):
- PGConnection
- PGPreparedStatement
PGPrepared statement has methods that take PGConnection as argument
and this in PGPreparedStatement.h I do:
#import "PGConnection.h"
And all is well.
The problem comes from then trying to create this method in
PGConnection:
-(PGPreparedStatement *) prepareStatement: (NSString *) sql nParams:
(int) nParams;
To make it compile, I also add (to PGConnection.h)
#import "PGPreparedStatement.h"
And all is not well. When I compile this, I get this error:
cd /Users/bas/dev/XCast
/usr/bin/gcc-4.0 -x objective-c -arch ppc -pipe -Wno-trigraphs -
fpascal-strings -fasm-blocks -g -O0 -Wreturn-type -Wunused-variable -
fmessage-length=0 -mtune=G5 -fvisibility=hidden -mfix-and-continue -
mmacosx-version-min=10.4 -I/Users/bas/dev/XCast/build/XCast.build/
Debug/XCast.build/XCast.hmap -F/Users/bas/dev/XCast/build/Debug -I/
usr/local/pgsql/include -I/Users/bas/dev/XCast/build/Debug/include -I/
Users/bas/dev/XCast/build/XCast.build/Debug/XCast.build/
DerivedSources -fobjc-exceptions -isysroot /Developer/SDKs/
MacOSX10.4u.sdk -c /Users/bas/dev/XCast/postgres/PGConnection.m -o /
Users/bas/dev/XCast/build/XCast.build/Debug/XCast.build/Objects-
normal/ppc/PGConnection.o
In file included from /Users/bas/dev/XCast/postgres/PGConnection.h:12,
from /Users/bas/dev/XCast/postgres/PGConnection.m:9:
/Users/bas/dev/XCast/postgres/PGPreparedStatement.h:14: error: parse
error before 'PGConnection'
/Users/bas/dev/XCast/postgres/PGPreparedStatement.h:19: error: parse
error before 'PGConnection'
/Users/bas/dev/XCast/postgres/PGPreparedStatement.h:20: fatal error:
method definition not in @implementation context
compilation terminated.
{standard input}:12:FATAL:.abort detected. Assembly stopping.
from /Users/bas/dev/XCast/postgres/PGConnection.m:9:
In file included from /Users/bas/dev/XCast/postgres/PGConnection.h:12,
/Users/bas/dev/XCast/postgres/PGPreparedStatement.h:14: error:
parse error before 'PGConnection'
So somehow, it does not like the circular import (importing
PGPreparedStatement.h in PGConnection.h and vice versa).
How does one deal with this case?
Thanks,
Bas.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden