audiococos2d-xappdelegatesimpleaudioengine

"SimpleAudioEngine has not been declared" error when trying to enable music pausing in Cocos2D-X


So using Cocos2D-X, in the AppDelegate.cpp file, I uncomment the line:

SimpleAudioEngine::sharedEngine()->pauseBackgroundMusic();

so that my audio will be paused when the app is exited. However, when I do this, I get the error stated in the title. How can I fix this?


Solution

  • the answer from Dmitry Fomin is correct, or after you put

    #include "SimpleAudioEngine.h"
    

    you can use

    CocosDenshion::SimpleAudioEngine::sharedEngine()->pauseBackgroundMusic();