Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8448775
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T10:31:14+00:00 2026-06-10T10:31:14+00:00

So I’m trying to replace the HelloWorld scene with a difficulty menu scene called

  • 0

So I’m trying to replace the HelloWorld scene with a difficulty menu scene called “diffMenu.” It works fine with XCode so I moved over to Eclipse to test the Android side and got an error that read “undefined reference to `diffMenu::scene()”
I’ve added diffMenu.ccp to the Android.mk but I still get the error.

Android.mk


LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

LOCAL_MODULE := game_shared

LOCAL_MODULE_FILENAME := libgame

LOCAL_SRC_FILES := helloworld/main.cpp \
               ../../Classes/AppDelegate.cpp \
               ../../Classes/HelloWorldScene.cpp \
               ../../Classes/diffMenu.ccp

LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../Classes                   

LOCAL_WHOLE_STATIC_LIBRARIES := cocos2dx_static cocosdenshion_static

include $(BUILD_SHARED_LIBRARY)

$(call import-module,CocosDenshion/android) $(call import-module,cocos2dx)







HelloWorldScene.ccp


#include "HelloWorldScene.h"
#include <sys/time.h>

#include "diffMenu.h"
USING_NS_CC; 


//using namespace CocosDenshion ;



CCScene* HelloWorld::scene()
{
    // 'scene' is an autorelease object
    CCScene *scene = CCScene::create();

    // 'layer' is an autorelease object
    HelloWorld *layer = HelloWorld::create();

    // add layer as a child to scene
    scene->addChild(layer);

    // return the scene
    return scene;
 }

    // on "init" you need to initialize your instance
    bool HelloWorld::init()
    {
        //////////////////////////////
        // 1. super init first
        if ( !CCLayer::init() )
        {
             return false;
        }




    CCSize size = CCDirector::sharedDirector()->getWinSize();
    CCSprite* background = CCSprite::create("menuBackground.jpg");
    //-------------------Background
    background->setPosition(ccp(170, 240));
    this->addChild(background, -1);

    //-------------------Green Play Now
    CCLabelTTF *playLabel = CCLabelTTF::create("Play Now", "American Typewriter", 40.0);
    CCMenuItemLabel *playNow = CCMenuItemLabel::create(playLabel, this,     menu_selector(HelloWorld::play));
    playNow->setPosition(ccp(0, 50));
    playNow->setColor(ccc3(0, 255, 0));


    //-------------------White Difficulty
    CCLabelTTF *diffLabel = CCLabelTTF::create("Difficulty", "American Typewriter", 40.0);
    CCMenuItemLabel *difficulty = CCMenuItemLabel::create(diffLabel, this,     menu_selector(HelloWorld::diff));
    difficulty->setPosition(ccp(0, -25));
     difficulty->setColor(ccc3(255, 255, 255));

    //-------------------White Language
    CCLabelTTF *langLabel = CCLabelTTF::create("Language", "American Typewriter", 40.0);
    CCMenuItemLabel *language = CCMenuItemLabel::create(langLabel, this,     menu_selector(HelloWorld::lang));
    language->setPosition(ccp(0, -100));
    language->setColor(ccc3(255, 0, 0));

    //-------------------Red Credits
    CCLabelTTF *credLabel = CCLabelTTF::create("Credits", "American Typewriter", 40.0);
    CCMenuItemLabel *credits = CCMenuItemLabel::create(credLabel, this,      menu_selector(HelloWorld::cred));
    credits->setPosition(ccp(0, -175));
    credits->setColor(ccc3(0, 0, 0));

    //-------------------Add Menu
    CCMenu *menu = CCMenu::create(playNow,difficulty,language,credits, NULL);
    this->addChild(menu,2) ;

    return true;
}
void HelloWorld::diff()
{




    CCDirector::sharedDirector()->setDepthTest(true);


    CCDirector::sharedDirector()->replaceScene(CCTransitionPageTurn::create(1.0f,       diffMenu::scene(), false));

}

void HelloWorld::play(){


}
void HelloWorld::cred(){


}

void HelloWorld::lang(){


}
void HelloWorld::menuCloseCallback(CCObject* pSender)
{
    CCDirector::sharedDirector()->end();

#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
    exit(0);
    #endif
}






diffMenu.h

#ifndef __diffMenu_SCENE_H__
#define __diffMenu_SCENE_H__

#include "cocos2d.h"
USING_NS_CC ;
class diffMenu : public cocos2d::CCLayer
{
public:
    // Here's a difference. Method 'init' in cocos2d-x returns bool, instead of returning      'id' in cocos2d-iphone
    virtual bool init();  

    // there's no 'id' in cpp, so we recommand to return the exactly class pointer
    static cocos2d::CCScene* scene();

    // a selector callback
    //void menuCloseCallback(CCObject* pSender);

    // implement the "static node()" method manually
    LAYER_CREATE_FUNC(diffMenu);


    void play();
    void diff();




};


#endif // __diffMenu_SCENE_H__



diffMenu.ccp

#include "SimpleAudioEngine.h"
#include "diffMenu.h"
using namespace cocos2d;
using namespace CocosDenshion;

CCScene* diffMenu::scene()
{
    // 'scene' is an autorelease object
    CCScene *scene = CCScene::create();

    // 'layer' is an autorelease object
    diffMenu *layer = diffMenu::create();

    // add layer as a child to scene
    scene->addChild(layer);

    // return the scene
    return scene;
}

// on "init" you need to initialize your instance
bool diffMenu::init()
{
//////////////////////////////
// 1. super init first
if ( !CCLayer::init() )
{
    return false;
}

/////////////////////////////
// 2. add a menu item with "X" image, which is clicked to quit the program
//    you may modify it.

// add a "close" icon to exit the progress. it's an autorelease object

    /////////////////////////////
    // 3. add your codes below...

    // add a label shows "Hello World"
    // create and initialize a label
    CCLabelTTF* pLabel = CCLabelTTF::create("Hello World", "Thonburi", 34);

    // ask director the window size
    CCSize size = CCDirector::sharedDirector()->getWinSize();

    // position the label on the center of the screen
    pLabel->setPosition( ccp(size.width / 2, size.height - 20) );

    // add the label as a child to this layer
    this->addChild(pLabel, 1);

    // add "diffMenu" splash screen"
    CCSprite* pSprite = CCSprite::create("pencilBackground.jpg");
    pSprite->setScale(.7);
    pSprite->setRotation(-1);
    // position the sprite on the center of the screen
    pSprite->setPosition( ccp(size.width/2-80, size.height/2) );

    // add the sprite as a child to this layer
    this->addChild(pSprite, 0);

    return true;
}

/*void diffMenu::menuCloseCallback(CCObject* pSender)
{
    CCDirector::sharedDirector()->end();

#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
    exit(0);
#endif
}*/
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T10:31:15+00:00Added an answer on June 10, 2026 at 10:31 am

    Finally it is an spelling error.
    It should be

    diffMenu.cpp
    

    not

    diffMenu.ccp
    

    in Android.mk

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to use string.replace('’','') to replace the dreaded weird single-quote character: ’ (aka
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I've got a string that has curly quotes in it. I'd like to replace
I am trying to render a haml file in a javascript response like so:
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I'm trying to select an H1 element which is the second-child in its group
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.