0

I'm trying to use Novocaine in an iPhone application I'm building. I can't figure out how to get around this error I'm getting:

Unknown type name 'RingBuffer'

Here's my file structure:

File structure

...with those files under Novocaine being the ones pulled from the Github repo for Novocaine. Here's my header file for DDViewController.

#import <UIKit/UIKit.h>
#import <QuartzCore/QuartzCore.h>
#import "UICoordButton.h"
#import "Novocaine.h"
#import "RingBuffer.h"
#import "AudioFileReader.h"
#import "AudioFileWriter.h"

@interface DDViewController : UIViewController
{
    RingBuffer *ringBuffer;
    Novocaine *audioManager;
    AudioFileReader *fileReader;
    AudioFileWriter *fileWriter;
}
- (IBAction)changeColor:(id)sender;
- (IBAction)changeColor2:(id)sender;
@end

I've tried a solution that I found on another question, which suggests that this should work:

@class RingBuffer;
@interface DDViewController : UIViewController
{
...

But that just gives me Redefinition of 'RingBuffer' as a different kind of symbol.

How can I fix this problem and use RingBuffer?

Community
  • 1
  • 1
varatis
  • 14,494
  • 23
  • 71
  • 114

2 Answers2

1

RingBuffer is a C++ class. I recommend you change the extension of your Objective-C files from .m to .mm which will make them Objective-C++

epatel
  • 45,805
  • 17
  • 110
  • 144
  • Just did that as well as adding `-fno-objc-arc` compiler flags to all the `.mm` files, which fixed a bunch of errors... yet my original problem still persists. – varatis Apr 14 '13 at 22:22
  • @varatis Please note that you will need to change extension to all `.m` files that #import and indirect #import `DDViewController.h` – epatel Apr 14 '13 at 22:27
  • I figured it out by just changing the compiler default to Objective-C++ for the project, but yeah, that would work too probably. – varatis Apr 14 '13 at 22:28
0

Found the answer (or I guess a combination of answers):

Follow coryalder's advice for setting the compiler default to Objective-C++ as described here.

Also, change all .m files to .mm files, and finally add -fno-objc-arc compiler flags to all the .mm files -- which is described in detail here.

Community
  • 1
  • 1
varatis
  • 14,494
  • 23
  • 71
  • 114