I had something like the following.  I prefer to have instance
variables declared explicitly rather than automatically generated:

// Foo.h
@interface Foo {
   Bar *bar;
}

@property bar;
@endif

// Foo.m

@interface Foo () { // ERROR here
   Baz *baz;
}
@endif

I spent a couple hours trying to figure out why I was getting:

   identifier or '(' expected before '{'

This should have worked because ivars in class extensions are
supported by the build of LLVM 3.0 that was included with Xcode 4.2.

After a while I noticed that there was a section header in my build
settings called "LLVM GCC - Language", despite the fact that I had
selected Apple LLVM 3.0 as my compiler.

It turned out that I had left LLVM-GCC selected as the compiler in my
target settings.  The target settings overrode the project settings.
The LLVM-GCC compiler uses GCC as the front end to parse Objective-C
code, which doesn't allow ivars in class extensions.  Setting the
compiler to Apple LLVM 3.0 in both the project and the target fixed
the error.

I've spent much of the evening trying to fix a bunch of screwy build
errors that I suspected were from corrupt project documents.  I keep
around a separate project to enable building with Xcode 3.2.6.  At
some point I tossed my current project document, copied the older
project, renamed it then opened it with Xcode 4.2.  It was at that
point that the above error started occurring.

I know what the separate project and target settings are meant to
accomplish, but despite having used Xcode since it was called Project
Builder, I still find these combined settings to be an endless source
of confusion.
Hope That Helps!
-- 
Don Quixote de la Mancha
Dulcinea Technologies Corporation
Software of Elegance and Beauty
http://www.dulcineatech.com
quix...@dulcineatech.com
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please 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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to