Saturday, 29 October 2011

Error "Sending 'ccColor4B' (aka 'struct_ccColor4B') to parameter of incompatible type 'CIColor *'"

While trying to compile some old Cocos2D projects, as attached, keep getting this error "Sending 'ccColor4B' (aka 'struct_ccColor4B') to parameter of incompatible type 'CIColor *'" in my Xcode 4.2

As below, the Cocos2D is version 0.99.01 according to "cocos2d.h". Looks like have to upgrade the Cocos2D in the project...

[UPDATE 16/01/2012]
I found the fix!

Instead of:


+ (id) layerWithColor:(ccColor4B)color
{
return [[[self alloc] initWithColor:color] autorelease];
}


The fix is to change it to as below, with the changed part highlighted and underlined.


+ (id) layerWithColor:(ccColor4B)color
{
return [[(CCColorLayer*)[self alloc] initWithColor:color] autorelease];
}


Note that this is for Cocos2D 0.99.x only, read on the net that it's renamed to "CCLayerColor" in later version.

Hope this helps!

4 comments:

  1. Hi, I solved this problem by upgrading Cocos2D to 1.1beta version...

    ReplyDelete
  2. Hello guys. I can not upgrade Cocos2D beta version. How can i upgrade?Please help .Thanks

    ReplyDelete
  3. Sorry, I don't know how to do that either. Have you tried the cocos2d for iPhone forum?

    ReplyDelete