Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm new to Cocos2d-x and working on a mac. I'm trying to play music in my demo project but I'm unable to include "SimpleAudioEngine.h" in the default HelloWorld Project. I tried adding CocosDenshion to my project but I got more errors. Anyone who knows how to fix this please help.

share|improve this question
up vote 3 down vote accepted

You need to add CocosDenshion, which is the audio library. Be sure the link is done correctly or copypaste it into your folder and use <> import just in case

#include <SimpleAudioEngine.h>

Once you have it correctly linked the functions used are quite trivial:


Be sure to be using the supported formats in each platform

share|improve this answer
In the default HelloWorld project CocosDenshion is not there so I'm unable to include SimpleAudioEngine.h I tried adding the folder to project in xcode but now I'm getting compiler errors. The best way i found till now is installing the template and then creating a new project. – 2600th Mar 14 '12 at 4:43
Don't add the folder, just the SimpleAudioEngine.h library in your Class folder, and include it with <>. The rest of the libraries are compiled and linked together and they don't have to be inside the HelloWorld folder. – MLProgrammer-CiM Mar 14 '12 at 10:16
Maybe I'm doing something wrong can't get SimpleAudioEngine to work with HelloWorldpProject. Thanks for the help ! :) – 2600th Mar 14 '12 at 14:36
Sadly I cannot send you my code, but the tutorial I used as reference is… I solved the linking problem the way I showed you, but the include is probably the cause. – MLProgrammer-CiM Mar 14 '12 at 14:39

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.