Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unknown type name 'class'; did you mean 'Class'? AurioTouch

I'm trying to move code from the AurioTouch project to my project. But I have many errors:

Unknown type name 'class'; did you mean 'Class'?

For example, in file FFTBufferManager.h:

#include <AudioToolbox/AudioToolbox.h>
#include <libkern/OSAtomic.h>

#include "SpectrumAnalysis.h"

class FFTBufferManager
{
public:
    FFTBufferManager(UInt32 inNumberFrames);
    ~FFTBufferManager();

I tried to change the compiler to LLVM GCC 4.2, but it gives a lot of other errors:

Expected '=', ',', ';', 'asm' or '__attribute__' before 'FFTBufferManager'

What am I doing wrong?

like image 442
LordPingvin Avatar asked Feb 23 '12 15:02

LordPingvin


1 Answers

To mix C++ and Objective-C you need to use the .mm extension. If, however, your class is only C++ (and only includes C/C++ headers) then you can use the normal .cpp extension.

.mm
A source file with this extension can contain C++ code in addition to Objective-C and C code. This extension should be used only if you actually refer to C++ classes or features from your Objective-C code.

like image 113
Joe Avatar answered Nov 14 '22 23:11

Joe