Search code examples
androideclipsecocos2d-x

cocos2d-x pure virtual method error only in eclipse


I'm following a Korean cocos2d-x book and example code is compiled and runs well in xcode & ios.

But eclipse complains about pure virtual method(The code is exactly same!)

Below is the error message.

The type 'GameObject' must implement the inherited pure virtual method 'cocos2d::CCRGBAProtocol::setOpacity'

class GameObject : public CCSprite

The code is nothing special. Defines a GameObject class and inherits from CCSprite.

I think CCRGBAProtocol or setOpacity is not necessary. Why is eclipse complains about that?

Thanks in advance.

(cocos2d-x version is 2.2, android project file is generated by cocos2d-x default script)


Solution

  • I have same issue before, it turns out should be Eclipse Code Analysis plug-in issue. Do the followings should resolve your issue.

    On your eclipse project, right click -> properties

    Under C/C++ General -> Code Analysis

    choose "Use project setting"

    then un-check the following checking:

    Syntax and Semantic Errors-> Abstract class cannot be instantiated

    It should resolve your issue.