Search code examples
iphoneiosfmod

Can't include FMOD on iOS


I don't think I'm including the FMOD library correctly. I'm getting the following XCode error: expected specifier-qualifier-list before FMOD

I'm using XCode 4 and the latest version of the FMOD library. I went into the "Link Binaries With Libraries" section in XCode and added libfmodex_iphonesimulator.a.

Any ideas on what I could be doing wrong?

Thanks!


Solution

  • Here is a step-by-step process for getting FMOD running in an iOS application:

    1. File -> New Project
    2. iOS -> Application -> Window based application
    3. Choose name and location (I used 'test' and the FMOD examples directory as the location)
    4. Assuming you named the app 'test', rename 'testAppDelegate.m' to have the extension '.mm' to allow C++ code.
    5. Edit 'testAppDelegate.mm' to have #import "fmod.hpp" at the top.
    6. Project -> Edit project settings (ensure Configuration at the top is set to All configurations)
    7. Go to "Other linker flags" and type in -lfmodex_$PLATFORM_NAME
    8. Go to "Header search paths" and type in ../../api/inc
    9. Go to "Library search paths" and type in ../../api/lib (now close settings).
    10. Right click on the "Frameworks" group on the left, choose Add -> Existing Frameworks, then choose 'CoreAudio.framework'
    11. Repeat step 10 but choose 'AudioToolbox.framework'
    12. Add FMOD code to 'testAppDelegate.mm' as needed, see playSound example for reference code.