Error with CCMutableArray<CCRect*>

I’m experiencing some problems using CCMutableArray<CCRect*>. I’m trying to throw an action if user has touched in some specific areas of the screen, so I try to define the rectangles where action is asociate by CCRect. Then I add all of these rectangles in a CCMutableArray to scan all of them with an iterator and compare with the touched point on the ccTouchesEnded function.

The code is something like this:

//in the init() function
CCRect* ccrect1 = new CCRect(484,0,506,50);
CCRect* ccrect2 = new CCRect(569,0,595,50);
buttons = CCMutableArray<CCRect*>::arrayWithObjects(ccrect1,ccrect2,NULL);

void HelloWorld::ccTouchesEnded(CCSet* touches, CCEvent* event)
{
// Choose one of the touches to work with
CCTouch* touch = (CCTouch**) );
CCPoint location = touch->locationInView);
location = CCDirector::sharedDirector~~>convertToGL;
//looking for which rectangle has been touched
CCMutableArray<CCRect*>::CCMutableArrayIterator it;
for ; it != buttons~~>end; it++)
{
CCRect**button =*it;
if(CCRect::CCRectContainsPoint(*button,location)){
//do something
break;
}
}
}

When I compile the code I got 2 error messages:
error: ‘class cocos2d::CCRect’ has no member named ‘retain’
error: ‘class cocos2d::CCRect’ has no member named ‘release’

Could anyone advise me what I’m missing…??
Thank you!

I think I’ve found the solution in this useful post: http://gameit.ro/2011/09/how-to-make-a-catapult-shooting-game-with-cocos2d-x-and-box2d/

It seems CCMutableArray just can store objects derived from CCObject, I’m right?

Thanks!

Yeah. And CCRect doesn’t inherit from CCObject. You can use stl containers like std::vector to hold them.