https://stackoverflow.com/questions/11919923/2-errors-when-calling-audioservicesplaysystemsound


I'm making an app which vibrates once a timer reaches a certain limit.

However, when calling

AudioServicesPlaySystemSound(kSystemSoundID_Vibrate);

Xcode comes up with two errors:

Undefined symbols for architecture i386:
  "_AudioServicesPlaySystemSound", referenced from:
      -[drawGraph drawRect:] in drawGraph.o
ld: symbol(s) not found for architecture i386

and

clang: error: linker command failed with exit code 1 (use -v to see invocation)

Any ideas on what is causing these errors?

27

enter image description here

If you simply must not add the header files only, as shown above, a framework must be added to your project. and you should a following header. #import <AudioToolbox/AudioToolbox.h>

  1. In Xcode, click your project file at the top of the Project Navigator.

  2. Click 'YourProjectName' under "Targets"

  3. Click the "Build Phases" tab.

  4. Click the plus in the "Link Binary With Libraries" window.

  5. Add the AudioToolbox.Framework library

  6. Add #import <AudioToolbox/AudioToolbox.h>

enter image description here