SimpleAudioEngine sharedEngine () message error

Hi, I’m new to cocos2d-x to android, I am trying to use “SimpleAudioEngine” to play an effect, but when compiling I get this: “undefined reference to CocosDenshion :: SimpleAudioEngine :: sharedEngine ()”, took several days with this problem thanks for your help. I’m using coco2d-x 2.0

You probably need to add CocosDenshion to linked libraries in linker options.

Maybe you did not add # include “SimpleAudioEngine.h”?

hi thanks for your help. I add “SimpleAudioEngine.h” in HelloWorldScene.cpp, as follows # include “… /… / CocosDenshion / include / SimpleAudioEngine.h” also try to copy in the Classes folder files “SimpleAudioEngine.h” and “Export.h”adding #include “SimpleAudioEngine.h” but the result is the same “undefined reference to CocosDenshion :: SimpleAudioEngine :: sharedEngine ()”

the code is:
—————

#include “HelloWorldScene.h”
#include “…/…/CocosDenshion/include/SimpleAudioEngine.h”

in the

bool HelloWorld::init()
{
….
CocosDenshion::SimpleAudioEngine::sharedEngine()->playBackgroundMusic(“background-music-aac.wav”, true);
….
}

like tutorial!

how i add CocosDenshion to linked libraries in linker options? thanks.

how i add CocosDenshion to linked libraries in linker options? thanks.

Depends on your IDE and OS. Try searching in project properties. You can look into cocos2d-x tests project files and do it like it is done there.

I use to compile “msys” like this ./build_native.sh
 in windows 7, this generates the files I needed to generate the apk then in eclipse, the error occurs when compiling with msys, all of this for android.
I follow this tutorial http://www.multigesture.net/articles/how-to-setup-cocos2d-x-windows-and-android/

I can now shoot, create villains, and collisions it’s work very nice, but i’m trying to put sound in the game, I follow this tutorial http://www.cocos2d-x.org/projects/cocos2d-x/wiki/Chapter_6*-*How_to_Play_Music_and_Sound_Effect

thanks.

I have no working configuration for Windows now, but as I can see you need to add following lines:

LOCAL_WHOLE_STATIC_LIBRARIES += cocosdenshion_static

$(call import-module,CocosDenshion/android)

to appropriate places of your Android.mk file which is located in jni folder.

thank you very much for your help, now works great, I copy the file android.mk:

LOCAL_C_INCLUDES := $(LOCAL_PATH)/…/…/Classes $(LOCAL_PATH)/…/…/…/CocosDenshion/include

LOCAL_WHOLE_STATIC_LIBRARIES := cocos2dx_static
LOCAL_WHOLE_STATIC_LIBRARIES += cocosdenshion_static

include $(BUILD_SHARED_LIBRARY)

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