A proj开发者_StackOverflow中文版ect that runs fine on Xcode3, fails to compile on Xcode4 with this error:
file://localhost/users/Ishaq/Projects/game01/libs/cocos2d/CCLayer.m: error: Semantic Issue: Sending 'ccColor4B' (aka 'struct _ccColor4B') to parameter of incompatible type 'CIColor *'
the code that throws this error is below (from cocos2d-iphone CCLayer.m
):
+ (id) layerWithColor:(ccColor4B)color
{
return [[[self alloc] initWithColor:color] autorelease];
}
Somehow Xcode thinks this code is calling - (id)initWithColor:(CIColor *)color;
of CIImage
(inside CIImage.h
). How can I set Xcode's brain straight? ;-)
I've got the same problem. My resolution was to explicitly cast it proper type which helps the compiler to find the proper class. So the code looks like this:
return [[(CCColorLayer*)[self alloc] initWithColor:color] autorelease];
You could change self
to the actual classname CCLayer
which should point Xcode in the right direction.
The same thing happened for me when using the "LLVM GCC 4.2" compiler. Changing the compiler setting to "Apple LLVM Compiler 3.0" fixed it.
精彩评论