Cocos2d-x compilation problems



  • Us NDK R9d, C+++, cocos2dx 3.8.1. Test cpp collects no mistakes, past projects as well, but new ones have problems.

    LOCAL_SRC_FILES := hellocpp/main.cpp \
                   ../../Classes/AppDelegate.cpp \
                   ../../Classes/EnemyStackLayer.cpp \
                   ../../Classes/GameOverScene.cpp \
                   ../../Classes/GameScene.cpp \
                   ../../Classes/LetClass.cpp \
                   ../../Classes/MainMenuScene.cpp \
                   ../../Classes/MyChar.cpp \
                   ../../Classes/MyHUDLayer.cpp \
                   ../../Classes/PauseScene.cpp
    

    If this section of the code is not removed, the compilation has not been successful:

        LetClass* LetClass::CreateLet(EnemyStackLayer* _gameplayLayer)
    {
        LetClass* ob = new LetClass();
    
    if (ob && ob->initEnemy(_gameplayLayer))
    {
        ob->autorelease();  
    
        ob->_addEvents();
    
        return ob;
    }
    
    CC_SAFE_DELETE(ob);
    return NULL;
    

    }

    Initiation

    bool LetClass::initEnemy(EnemyStackLayer* _gameplayLayer)
    {
    cocos2d::CCSize visibleSize = CCDirector::sharedDirector()->getVisibleSize();
    gameplayLayer = _gameplayLayer;

    Health = 2.0;
    DamageToHero = 1.0;
    primaryHP = 2.0;
    
    
    Speed = gameplayLayer->NewS;
    
    int min = 95;
    int max = visibleSize.width - 95;
    
    int rnd = (CCRANDOM_0_1() * (max - min)) + min;
    playerSprite = Sprite::create("GameScreen/Asteroid_0.png");
    cocos2d::Point p = cocos2d::Point(rnd, -5);
    playerSprite->setPosition(p);
    
    addChild(playerSprite, -1);
    
    
    return true;
    

    }

    Title:

    class LetClass : public cocos2d::Sprite
    {
    public:
    EnemyStackLayer* gameplayLayer;

    static LetClass* CreateLet(EnemyStackLayer* _gameplayLayer);
    bool initEnemy(EnemyStackLayer* _gameplayLayer);
    
    cocos2d::Sprite *playerSprite;
    



  • Problem solved I had to change the functions of the seats.




Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2