I create an mm file which works fine in Xcode, but cannot work in Eclipse when I build it for Android project.
@
String* UtilityTool::getValue()
{
String* currentValue = new String(“”);
#if (CC_TARGET_PLATFORM CC_PLATFORM_IOS)
//Objective-C codes
#elif (CC_TARGET_PLATFORM CC_PLATFORM_ANDROID)
//Android codes
#endif
return currentValue;
}@
I add these codes in Android.mk which can drive NDK compile mm as c**,
@
LOCAL_CPP_EXTENSION*= .mm
LOCAL_CFLAGS*= -x c++
@
but it always report error as:
/Users/xxxx/Documents/GameStudio/cocos2d-x-3.0alpha0/projects/PopStarDeluxe/proj.android/…/…/…/cocos2dx/platform/android/nativeactivity.cpp:121: error: undefined reference to ‘cocos_android_app_init(android_app*)’
If I change the extension to cpp, it works fine. How to resolve this problem?