2

I'm sure the answer is simple but I am facing the following problem ...

I want to use this c++ header file CAAudioUnitOutputCapturer.h (there is only a .h file) inside an ios objective-c xcode project.

Could someone tell me how to eliminate compilation errors and give me an example of how to use in Objective-C context?

Edit, i got this error :

CAAudioUnitOutputCapturer.h:64: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'CAAudioUnitOutputCapturer'
2
  • What are the errors? How can one tell you how to avoid errors if you don't tell what are the errors? Commented Sep 5, 2011 at 17:06
  • Edited with compilation error Commented Sep 5, 2011 at 17:09

3 Answers 3

4

At the moment, the compiler is trying to build your file as pure Objective C, which is causing these errors. Rename the file you are compiling it into as myFile.mm (note the mm extension). This will force the compiler to consider it as Objective C++ code, which by virtue of the header you're including, it is.

Sign up to request clarification or add additional context in comments.

Comments

1

Any files that use the CAAudioUnitOutputCapturer classes must be Objective-C++ instead of Objective-C. You do that by using a .mm extension instead of .m.

In .mm files you can mix Objective-C classes and C++ classes.

Here is some information regarding Objective-C++.

Comments

1

The files in which you use the CAAudioUnitOutputCapturer.h must either be Objective C++ files (default extension .mm), or C++ files (extension .cpp or .cc). If you try to use them in an Objective C (extension .m) file you'll get errors, as the compiler is expecting Objective C, not C++.

I do hope you have the object file or library file that contains the (compiled) code for the CAAudioUnitOutputCapturer class, otherwise your .h file is useless.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.