views:

83

answers:

1

Fellow coders,

I wrote an iPhone app that plays wma stream, using libmms and ffmpeg open source libraries. The app has already been approved by Apple and is available for download, free of charge.

Now I'd like to have a VU meter on my app.

I'm using the avTouch code sample, downloaded from Apple (https://developer.apple.com/iphone/library/samplecode/avTouch/Introduction/Intro.html).

I just can't figure out how to mix cpp and objc. When I put the avTouchViewController and avTouchController in the Document (command+o) at Interface Builder, and simply try to build and run the program, it crashes just after the Default image.

What am I missing? What should I do to correct this problem? Or, even better, does anyone have a code sample that I could use to have a VU meter on my app?

Thanks for your attention!

A: 

To use Objective-C++ you will need to (the simplest way) ensure your source file name ends in ".mm" instead of ".m". If the latter, the compiler guesses it's just Objective-C, if the former it assumes Objective-C++. You can explicitly set the compiler flags in the build settings, but why when you can just rename the file? :)

Once the compiler knows what's in the source file you're trying to compile, you should be well on your way.

jer
I'll rename the files with a .mm extension and will let you know how things go. Thanks!
Thanks! That solved my problem!