使用eclipse里有时会无端报错,检查都不能通过,后来参考了这个网页:
http://www.cocos2d-x.org/forums/6/topics/6684
Hi,all
I follow sample http://www.cocos2d-x.org/projects/cocos2d-x/wiki/Chapter\_7*-*Some\_Icing\_on\_the\_Cake
and type code in GameOverScene.h header file
class GameOverLayer : public cocos2d::CCLayerColor
{
public:
GameOverLayer():_label(NULL) {};
virtual <sub>GameOverLayer;
bool init;
LAYER_NODE_FUNC;
void gameOverDone;
CC_SYNTHESIZE_READONLY;
};
but the method
LAYER_NODE_FUNC;
error</sub>?
the tips is “The type ‘GameOverLayer’ must implement the inherited pure virtual method ‘cocos2d::CCRGBAProtocol::setOpacity’”
Is this my false or there is something def in cocos2d-1.0.1-x-0.10.0?
答案:
Might be useful for future newbies.
You goto Eclipse>Preferences>C/C++>Code Analysis>Syntax and Semantic Errors
Uncheck “Abstract classes cannot be instantiated”
这里告诉我们,主要是我们IDE语法检查过严引起的,修改一下就可以了。