ControlSwitch android上使用报错，这个到底怎么搞啊，，，，，，，

lixa8
Fri, 13 Jun 2014 03:31:30 +0000

求助，各位牛人，ControlSwitch创建报错，这个应该不是头文件之类的错误，
创建代码：

ControlSwitch *cs = ControlSwitch::create(Sprite::create("switcher_bg.png"), Sprite::create("switcher_on.png"), Sprite::create("switcher_off.png"), Sprite::create("switcher_thumb.png"), Label::createWithSystemFont("ON", "Arial-BoldMT", 48), Label::createWithSystemFont("OFF", "Arial-BoldMT", 48));
```

报错信息：

 SharedLibrary  : libcocos2dcpp.so
jni/../../Classes/layers/SettingLayer.cpp:37: error: undefined reference to 'cocos2d::extension::ControlSwitch::create(cocos2d::Sprite*, cocos2d::Sprite*, cocos2d::Sprite*, cocos2d::Sprite*, cocos2d::Label*, cocos2d::Label*)'
jni/../../Classes/layers/SettingLayer.cpp:49: error: undefined reference to 'cocos2d::extension::ControlSwitch::setOn(bool, bool)'
collect2: error: ld returned 1 exit status
make: ***  Error 1
make: Leaving directory `/Users/jozeli/Documents/work/android/2ccs/cocos2d-x-3.1/projects/RedBan/proj.android'
Traceback (most recent call last):
  File "build_native.py", line 166, in
    build(opts.ndk_build_param,opts.android_platform,opts.build_mode)
  File "build_native.py", line 153, in build
    do_build(cocos_root, ndk_root, app_android_root,ndk_build_param,sdk_root,android_platform,build_mode)
  File "build_native.py", line 89, in do_build
    raise Exception("Build dynamic library for project  " + app_android_root + " ] fails!")
Exception: Build dynamic library for project  /Users/jozeli/Documents/work/android/2ccs/cocos2d-x-3.1/projects/RedBan/proj.android ] fails!

```


android.mk配置：

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

LOCAL_WHOLE_STATIC_LIBRARIES := cocos2dx_static
LOCAL_WHOLE_STATIC_LIBRARIES += cocosdenshion_static

# LOCAL_WHOLE_STATIC_LIBRARIES += box2d_static
# LOCAL_WHOLE_STATIC_LIBRARIES += cocosbuilder_static
# LOCAL_WHOLE_STATIC_LIBRARIES += spine_static
# LOCAL_WHOLE_STATIC_LIBRARIES += cocostudio_static
# LOCAL_WHOLE_STATIC_LIBRARIES += cocos_network_static
# LOCAL_WHOLE_STATIC_LIBRARIES += cocos_extension_static


include $(BUILD_SHARED_LIBRARY)

$(call import-module,.)
$(call import-module,audio/android)

# $(call import-module,Box2D)
# $(call import-module,editor-support/cocosbuilder)
# $(call import-module,editor-support/spine)
# $(call import-module,editor-support/cocostudio)
# $(call import-module,network)
# $(call import-module,extensions)


```


这个是下面的配置，上面的源文件配置就不贴出来了，网上找了好多版本，没用，ios正常

阅读整个主题